Skip to content

custom-resources: add refresh trigger property to AwsCustomResource #38817

Description

@faridnsh

Describe the feature

Add an optional property to AwsCustomResource whose only purpose is to participate in CloudFormation change detection.

When the value of this property changes, CloudFormation would send an Update event to the custom resource, causing the configured onUpdate SDK call to run again.

The property would not be passed to the AWS SDK call itself.

For example:

new AwsCustomResource(this, 'Resource', {
  onUpdate: {
    service: 'SomeService',
    action: 'someAction',
    parameters: {
      // ...
    },
    physicalResourceId: PhysicalResourceId.of('Resource'),
  },
  updateTrigger: someParameter.valueAsString,
  policy: AwsCustomResourcePolicy.fromSdkCalls({
    resources: AwsCustomResourcePolicy.ANY_RESOURCE,
  }),
});

Use Case

There are cases where an AwsCustomResource needs to rerun its onUpdate call because some external deployment input changed, even though that input is not itself a parameter to the AWS SDK operation.

For example, an SSM parameter, configuration version, hash, or another resource attribute may determine when the SDK call should be refreshed.

Proposed Solution

No response

Other Information

Would be happy to make a pull request if the maintainers are happy with this feature.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS CDK Library version (aws-cdk-lib)

2.269.0

AWS CDK CLI version

2.1141.0

Environment details (OS name and version, etc.)

Not relevant

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/custom-resourcesRelated to AWS CDK Custom Resourceseffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions