Skip to content
v2.278.0

CfnResourceProps Struct ​

Example ​

ts
class MyConstruct extends Resource implements ITaggable {
  public readonly tags = new TagManager(TagType.KEY_VALUE, 'Whatever::The::Type');

  constructor(scope: Construct, id: string) {
    super(scope, id);

    new CfnResource(this, 'Resource', {
      type: 'Whatever::The::Type',
      properties: {
        // ...
        Tags: this.tags.renderedTags,
      },
    });
  }
}
python
@jsii.implements(ITaggable)
class MyConstruct(Resource):

    def __init__(self, scope, id):
        super().__init__(scope, id)

        CfnResource(self, "Resource",
            type="Whatever::The::Type",
            properties={
                # ...
                "Tags": self.tags.rendered_tags
            }
        )
java
public class MyConstruct extends Resource implements ITaggable {
    public final Object tags;

    public MyConstruct(Construct scope, String id) {
        super(scope, id);

        CfnResource.Builder.create(this, "Resource")
                .type("Whatever::The::Type")
                .properties(Map.of(
                        // ...
                        "Tags", this.tags.getRenderedTags()))
                .build();
    }
}
csharp
// Install: dotnet add package Amazon.CDK.Lib
class MyConstruct : Resource, ITaggable
{
    public readonly void Tags = new TagManager(TagType.KEY_VALUE, "Whatever::The::Type");

    public MyConstruct(Construct scope, string id) : base(scope, id)
    {

        new CfnResource(this, "Resource", new CfnResourceProps {
            Type = "Whatever::The::Type",
            Properties = new Dictionary<string, object> {
                // ...
                { "Tags", Tags.RenderedTags }
            }
        });
    }
}
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
type myConstruct struct {
	Resource
	tags
}

func newMyConstruct(scope Construct, id *string) *myConstruct {
	this := &myConstruct{}
	newResource_Override(this, scope, id)

	awscdk.NewCfnResource(this, jsii.String("Resource"), &CfnResourceProps{
		Type: jsii.String("Whatever::The::Type"),
		Properties: map[string]interface{}{
			// ...
			"Tags": this.tags.renderedTags,
		},
	})
	return this
}

Properties ​

propertiesoptional{ [key: string]: any }propertiesoptionaltyping.Mapping[str, Any]propertiesoptionalMap<String, Object>PropertiesoptionalIDictionary<string, object>Propertiesoptional*map[string]interface{} #
Resource properties.

Default: No resource properties.

typestringtypestrtypeStringTypestringType*string required #
CloudFormation resource type (e.g. `AWS::S3::Bucket`).