Skip to content
v2.274.0

PhysicalResourceIdReference Class ​

Reference to the physical resource id that can be passed to the AWS operation as a parameter.

Example ​

ts
const awsCustom = new cr.AwsCustomResource(this, 'aws-custom', {
  onCreate: {
    service: '...',
    action: '...',
    parameters: {
      text: '...',
    },
    physicalResourceId: cr.PhysicalResourceId.of('...'),
  },
  onUpdate: {
    service: '...',
    action: '...',
    parameters: {
      text: '...',
      resourceId: new cr.PhysicalResourceIdReference(),
    },
  },
  policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
    resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
  }),
})
python
aws_custom = cr.AwsCustomResource(self, "aws-custom",
    on_create=cr.AwsSdkCall(
        service="...",
        action="...",
        parameters={
            "text": "..."
        },
        physical_resource_id=cr.PhysicalResourceId.of("...")
    ),
    on_update=cr.AwsSdkCall(
        service="...",
        action="...",
        parameters={
            "text": "...",
            "resource_id": cr.PhysicalResourceIdReference()
        }
    ),
    policy=cr.AwsCustomResourcePolicy.from_sdk_calls(
        resources=cr.AwsCustomResourcePolicy.ANY_RESOURCE
    )
)
java
AwsCustomResource awsCustom = AwsCustomResource.Builder.create(this, "aws-custom")
        .onCreate(AwsSdkCall.builder()
                .service("...")
                .action("...")
                .parameters(Map.of(
                        "text", "..."))
                .physicalResourceId(PhysicalResourceId.of("..."))
                .build())
        .onUpdate(AwsSdkCall.builder()
                .service("...")
                .action("...")
                .parameters(Map.of(
                        "text", "...",
                        "resourceId", new PhysicalResourceIdReference()))
                .build())
        .policy(AwsCustomResourcePolicy.fromSdkCalls(SdkCallsPolicyOptions.builder()
                .resources(AwsCustomResourcePolicy.ANY_RESOURCE)
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var awsCustom = new AwsCustomResource(this, "aws-custom", new AwsCustomResourceProps {
    OnCreate = new AwsSdkCall {
        Service = "...",
        Action = "...",
        Parameters = new Dictionary<string, string> {
            { "text", "..." }
        },
        PhysicalResourceId = PhysicalResourceId.Of("...")
    },
    OnUpdate = new AwsSdkCall {
        Service = "...",
        Action = "...",
        Parameters = new Dictionary<string, object> {
            { "text", "..." },
            { "resourceId", new PhysicalResourceIdReference() }
        }
    },
    Policy = AwsCustomResourcePolicy.FromSdkCalls(new SdkCallsPolicyOptions {
        Resources = AwsCustomResourcePolicy.ANY_RESOURCE
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
awsCustom := cr.NewAwsCustomResource(this, jsii.String("aws-custom"), &AwsCustomResourceProps{
	OnCreate: &AwsSdkCall{
		Service: jsii.String("..."),
		Action: jsii.String("..."),
		Parameters: map[string]*string{
			"text": jsii.String("..."),
		},
		PhysicalResourceId: cr.PhysicalResourceId_Of(jsii.String("...")),
	},
	OnUpdate: &AwsSdkCall{
		Service: jsii.String("..."),
		Action: jsii.String("..."),
		Parameters: map[string]interface{}{
			"text": jsii.String("..."),
			"resourceId": cr.NewPhysicalResourceIdReference(),
		},
	},
	Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
		Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
	}),
})

Initializer ​

ts
new PhysicalResourceIdReference()
python
PhysicalResourceIdReference()
java
new PhysicalResourceIdReference()
csharp
new PhysicalResourceIdReference()
go
NewPhysicalResourceIdReference()

Properties ​

creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*stringrequired#
The creation stack of this resolvable which will be appended to errors thrown during resolution.

This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.

Methods ​

resolve(_context: IResolveContext): anydef resolve(self, _context: IResolveContext) -> Anypublic Object resolve(IResolveContext _context)public object Resolve(IResolveContext _context)func Resolve(_context IResolveContext) interface{}#
Produce the Token's value at resolution time.
toJSON(): stringdef to_json(self, ) -> strpublic String toJSON()public string ToJSON()func ToJSON() *string#
toJSON serialization to replace `PhysicalResourceIdReference` with a magic string.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Return a string representation of this resolvable object.

Returns a reversible string representation.