Using wildcards with Hook target names
You can use wildcards as part of the target name. You can use wildcard characters (*
and
?
) within your Hook target names. The asterisk (*
) represents any combination of
characters. The question mark (?
) represents any single character. You can use multiple *
and ?
characters in a target name.
Example : Examples of target name wildcards in Hook schemas
The following example targets all resource types supported by Amazon S3.
{ ... "handlers": { "preCreate": { "targetNames": [ "AWS::S3::*" ], "permissions": [] } } ... }
The following example matches all resource types that have "Bucket" in the name.
{ ... "handlers": { "preCreate": { "targetNames": [ "AWS::*::Bucket*" ], "permissions": [] } } ... }
The AWS::*::Bucket*
might resolve to any of the following concrete resource types:
-
AWS::Lightsail::Bucket
-
AWS::S3::Bucket
-
AWS::S3::BucketPolicy
-
AWS::S3Outpost::Bucket
-
AWS::S3Outpost::BucketPolicy
Example : Examples of target name wildcards in Hook configuration schemas
The following example configuration invokes the Hook for CREATE
operations on all Amazon S3 resource types,
and for UPDATE
operations on all named table resource types, such as AWS::DynamobDB::Table
or
AWS::Glue::Table
.
{ "CloudFormationConfiguration": { "HookConfiguration": { "TargetStacks": "ALL", "FailureMode": "FAIL", "Properties": {}, "TargetFilters":{ "Targets": [ { "TargetName": "AWS::S3::*", "Action": "CREATE", "InvocationPoint": "PRE_PROVISION" }, { "TargetName": "AWS::*::Table", "Action": "UPDATE", "InvocationPoint": "PRE_PROVISION" } ] } } } }
The following example configuration invokes the Hook for CREATE
and UPDATE
operations on all Amazon S3
resource types, and also for CREATE
and UPDATE
operations on all named table resource types, such as
AWS::DynamobDB::Table
or AWS::Glue::Table
.
{ "CloudFormationConfiguration": { "HookConfiguration": { "TargetStacks": "ALL", "FailureMode": "FAIL", "Properties": {}, "TargetFilters":{ "TargetNames": [ "AWS::S3::*", "AWS::*::Table" ], "Actions": [ "CREATE", "UPDATE" ], "InvocationPoints": [ "PRE_PROVISION" ] } } } }