ResourceType class

Resource for managing an AWS Resource Groups Resource.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ec2.DedicatedHost("example", {
    instanceFamily: "t3",
    availabilityZone: "us-east-1a",
    hostRecovery: "off",
    autoPlacement: "on",
});
const exampleGroup = new aws.resourcegroups.Group("example", {name: "example"});
const exampleResource = new aws.resourcegroups.Resource("example", {
    groupArn: exampleGroup.arn,
    resourceArn: example.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.ec2.DedicatedHost("example",
    instance_family="t3",
    availability_zone="us-east-1a",
    host_recovery="off",
    auto_placement="on")
example_group = aws.resourcegroups.Group("example", name="example")
example_resource = aws.resourcegroups.Resource("example",
    group_arn=example_group.arn,
    resource_arn=example.arn)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Ec2.DedicatedHost("example", new()
    {
        InstanceFamily = "t3",
        AvailabilityZone = "us-east-1a",
        HostRecovery = "off",
        AutoPlacement = "on",
    });

    var exampleGroup = new Aws.ResourceGroups.Group("example", new()
    {
        Name = "example",
    });

    var exampleResource = new Aws.ResourceGroups.Resource("example", new()
    {
        GroupArn = exampleGroup.Arn,
        ResourceArn = example.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/resourcegroups"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ec2.NewDedicatedHost(ctx, "example", &ec2.DedicatedHostArgs{
			InstanceFamily:   pulumi.String("t3"),
			AvailabilityZone: pulumi.String("us-east-1a"),
			HostRecovery:     pulumi.String("off"),
			AutoPlacement:    pulumi.String("on"),
		})
		if err != nil {
			return err
		}
		exampleGroup, err := resourcegroups.NewGroup(ctx, "example", &resourcegroups.GroupArgs{
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = resourcegroups.NewResource(ctx, "example", &resourcegroups.ResourceArgs{
			GroupArn:    exampleGroup.Arn,
			ResourceArn: example.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_ec2_dedicatedhost" "example" {
  instance_family   = "t3"
  availability_zone = "us-east-1a"
  host_recovery     = "off"
  auto_placement    = "on"
}
resource "aws_resourcegroups_group" "example" {
  name = "example"
}
resource "aws_resourcegroups_resource" "example" {
  group_arn    = aws_resourcegroups_group.example.arn
  resource_arn = aws_ec2_dedicatedhost.example.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.DedicatedHost;
import com.pulumi.aws.ec2.DedicatedHostArgs;
import com.pulumi.aws.resourcegroups.Group;
import com.pulumi.aws.resourcegroups.GroupArgs;
import com.pulumi.aws.resourcegroups.Resource;
import com.pulumi.aws.resourcegroups.ResourceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new DedicatedHost("example", DedicatedHostArgs.builder()
            .instanceFamily("t3")
            .availabilityZone("us-east-1a")
            .hostRecovery("off")
            .autoPlacement("on")
            .build());

        var exampleGroup = new Group("exampleGroup", GroupArgs.builder()
            .name("example")
            .build());

        var exampleResource = new Resource("exampleResource", ResourceArgs.builder()
            .groupArn(exampleGroup.arn())
            .resourceArn(example.arn())
            .build());

    }
}
resources:
  example:
    type: aws:ec2:DedicatedHost
    properties:
      instanceFamily: t3
      availabilityZone: us-east-1a
      hostRecovery: off
      autoPlacement: on
  exampleGroup:
    type: aws:resourcegroups:Group
    name: example
    properties:
      name: example
  exampleResource:
    type: aws:resourcegroups:Resource
    name: example
    properties:
      groupArn: ${exampleGroup.arn}
      resourceArn: ${example.arn}

Import

Using pulumi import, import an AWS Resource Groups Resource using groupArn and resourceArn, separated by a comma (,). For example:

$ pulumi import aws:resourcegroups/resource:Resource example arn:aws:resource-groups:us-west-2:012345678901:group/example,arn:aws:lambda:us-west-2:012345678901:function:example

Constructors

ResourceType(String name, {ResourceArgs? args, CustomResourceOptions? options})
Creates a new ResourceType. name The Pulumi resource name. args Arguments used to configure this ResourceType. The set of arguments for Resource. options Resource options controlling this resource's behavior.
ResourceType.reference(String urn)
Creates a typed reference to an existing ResourceType resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
groupArn ↔ Output<String>
Name or ARN of the resource group to add resources to.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceArn ↔ Output<String>
ARN of the resource to be added to the group.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
resourceType ↔ Output<String>
The resource type of a resource, such as AWS::EC2::Instance.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ResourceState? state, CustomResourceOptions? options}) → ResourceType
Gets an existing ResourceType resource's state with the given name and id.