1. Packages
  2. AWS
  3. API Docs
  4. resourcegroups
  5. Resource
AWS v6.77.1 published on Friday, Apr 18, 2025 by Pulumi

aws.resourcegroups.Resource

Explore with Pulumi AI

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,
});
Copy
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)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v6/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
	})
}
Copy
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,
    });

});
Copy
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.List;
import java.util.ArrayList;
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());

    }
}
Copy
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}
Copy

Create Resource Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Resource(name: string, args: ResourceArgs, opts?: CustomResourceOptions);
@overload
def Resource(resource_name: str,
             args: ResourceArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Resource(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             group_arn: Optional[str] = None,
             resource_arn: Optional[str] = None)
func NewResource(ctx *Context, name string, args ResourceArgs, opts ...ResourceOption) (*Resource, error)
public Resource(string name, ResourceArgs args, CustomResourceOptions? opts = null)
public Resource(String name, ResourceArgs args)
public Resource(String name, ResourceArgs args, CustomResourceOptions options)
type: aws:resourcegroups:Resource
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ResourceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ResourceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ResourceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ResourceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var exampleresourceResourceResourceFromResourcegroupsresource = new Aws.ResourceGroups.Resource("exampleresourceResourceResourceFromResourcegroupsresource", new()
{
    GroupArn = "string",
    ResourceArn = "string",
});
Copy
example, err := resourcegroups.NewResource(ctx, "exampleresourceResourceResourceFromResourcegroupsresource", &resourcegroups.ResourceArgs{
	GroupArn:    pulumi.String("string"),
	ResourceArn: pulumi.String("string"),
})
Copy
var exampleresourceResourceResourceFromResourcegroupsresource = new com.pulumi.aws.resourcegroups.Resource("exampleresourceResourceResourceFromResourcegroupsresource", com.pulumi.aws.resourcegroups.ResourceArgs.builder()
    .groupArn("string")
    .resourceArn("string")
    .build());
Copy
exampleresource_resource_resource_from_resourcegroupsresource = aws.resourcegroups.Resource("exampleresourceResourceResourceFromResourcegroupsresource",
    group_arn="string",
    resource_arn="string")
Copy
const exampleresourceResourceResourceFromResourcegroupsresource = new aws.resourcegroups.Resource("exampleresourceResourceResourceFromResourcegroupsresource", {
    groupArn: "string",
    resourceArn: "string",
});
Copy
type: aws:resourcegroups:Resource
properties:
    groupArn: string
    resourceArn: string
Copy

Resource Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Resource resource accepts the following input properties:

GroupArn
This property is required.
Changes to this property will trigger replacement.
string
Name or ARN of the resource group to add resources to.
ResourceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the resource to be added to the group.
GroupArn
This property is required.
Changes to this property will trigger replacement.
string
Name or ARN of the resource group to add resources to.
ResourceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the resource to be added to the group.
groupArn
This property is required.
Changes to this property will trigger replacement.
String
Name or ARN of the resource group to add resources to.
resourceArn
This property is required.
Changes to this property will trigger replacement.
String
ARN of the resource to be added to the group.
groupArn
This property is required.
Changes to this property will trigger replacement.
string
Name or ARN of the resource group to add resources to.
resourceArn
This property is required.
Changes to this property will trigger replacement.
string
ARN of the resource to be added to the group.
group_arn
This property is required.
Changes to this property will trigger replacement.
str
Name or ARN of the resource group to add resources to.
resource_arn
This property is required.
Changes to this property will trigger replacement.
str
ARN of the resource to be added to the group.
groupArn
This property is required.
Changes to this property will trigger replacement.
String
Name or ARN of the resource group to add resources to.
resourceArn
This property is required.
Changes to this property will trigger replacement.
String
ARN of the resource to be added to the group.

Outputs

All input properties are implicitly available as output properties. Additionally, the Resource resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
ResourceType string
The resource type of a resource, such as AWS::EC2::Instance.
Id string
The provider-assigned unique ID for this managed resource.
ResourceType string
The resource type of a resource, such as AWS::EC2::Instance.
id String
The provider-assigned unique ID for this managed resource.
resourceType String
The resource type of a resource, such as AWS::EC2::Instance.
id string
The provider-assigned unique ID for this managed resource.
resourceType string
The resource type of a resource, such as AWS::EC2::Instance.
id str
The provider-assigned unique ID for this managed resource.
resource_type str
The resource type of a resource, such as AWS::EC2::Instance.
id String
The provider-assigned unique ID for this managed resource.
resourceType String
The resource type of a resource, such as AWS::EC2::Instance.

Look up Existing Resource Resource

Get an existing Resource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ResourceState, opts?: CustomResourceOptions): Resource
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        group_arn: Optional[str] = None,
        resource_arn: Optional[str] = None,
        resource_type: Optional[str] = None) -> Resource
func GetResource(ctx *Context, name string, id IDInput, state *ResourceState, opts ...ResourceOption) (*Resource, error)
public static Resource Get(string name, Input<string> id, ResourceState? state, CustomResourceOptions? opts = null)
public static Resource get(String name, Output<String> id, ResourceState state, CustomResourceOptions options)
resources:  _:    type: aws:resourcegroups:Resource    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
GroupArn Changes to this property will trigger replacement. string
Name or ARN of the resource group to add resources to.
ResourceArn Changes to this property will trigger replacement. string
ARN of the resource to be added to the group.
ResourceType string
The resource type of a resource, such as AWS::EC2::Instance.
GroupArn Changes to this property will trigger replacement. string
Name or ARN of the resource group to add resources to.
ResourceArn Changes to this property will trigger replacement. string
ARN of the resource to be added to the group.
ResourceType string
The resource type of a resource, such as AWS::EC2::Instance.
groupArn Changes to this property will trigger replacement. String
Name or ARN of the resource group to add resources to.
resourceArn Changes to this property will trigger replacement. String
ARN of the resource to be added to the group.
resourceType String
The resource type of a resource, such as AWS::EC2::Instance.
groupArn Changes to this property will trigger replacement. string
Name or ARN of the resource group to add resources to.
resourceArn Changes to this property will trigger replacement. string
ARN of the resource to be added to the group.
resourceType string
The resource type of a resource, such as AWS::EC2::Instance.
group_arn Changes to this property will trigger replacement. str
Name or ARN of the resource group to add resources to.
resource_arn Changes to this property will trigger replacement. str
ARN of the resource to be added to the group.
resource_type str
The resource type of a resource, such as AWS::EC2::Instance.
groupArn Changes to this property will trigger replacement. String
Name or ARN of the resource group to add resources to.
resourceArn Changes to this property will trigger replacement. String
ARN of the resource to be added to the group.
resourceType String
The resource type of a resource, such as AWS::EC2::Instance.

Import

Using pulumi import, import an AWS Resource Groups Resource using group_arn and resource_arn, 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
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.