AWS::CloudFormation::HookDefaultVersion
The HookDefaultVersion resource specifies the default version of the hook. The default version of
the hook is used in CloudFormation operations for this Amazon Web Services account and Amazon Web Services Region.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::CloudFormation::HookDefaultVersion", "Properties" : { "TypeName" :String, "TypeVersionArn" :String, "VersionId" :String} }
YAML
Type: AWS::CloudFormation::HookDefaultVersion Properties: TypeName:StringTypeVersionArn:StringVersionId:String
Properties
TypeName-
The name of the hook.
You must specify either
TypeVersionArn, orTypeNameandVersionId.Required: Conditional
Type: String
Minimum:
1Maximum:
255Update requires: No interruption
TypeVersionArn-
The version ID of the type configuration.
You must specify either
TypeVersionArn, orTypeNameandVersionId.Required: Conditional
Type: String
Minimum:
1Maximum:
128Pattern:
[A-Za-z0-9-]+Update requires: No interruption
VersionId-
The version ID of the type specified.
You must specify either
TypeVersionArn, orTypeNameandVersionId.Required: Conditional
Type: String
Minimum:
1Maximum:
128Pattern:
[A-Za-z0-9-]+Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns the Amazon Resource Name (ARN) of the resource version. For example:
arn:aws:cloudformation:us-west-2:012345678901:type/hook/Sample-CloudFormation-Hook/00000001
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Examples
Specifying a hook default version
The following example demonstrates how to specify a new hook version and use the Ref return value to set that version as the default version.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "HookVersion": { "Type": "AWS::CloudFormation::HookVersion", "Properties": { "TypeName": "My::Sample::Hook", "SchemaHandlerPackage": "s3://my-sample-hookversion-bucket/my-sample-hook.zip" } }, "HookDefaultVersion": { "Type": "AWS::CloudFormation::HookDefaultVersion", "Properties": { "TypeVersionArn": { "Ref": "HookVersion" } } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: HookVersion: Type: 'AWS::CloudFormation::HookVersion' Properties: TypeName: 'My::Sample::Hook' SchemaHandlerPackage: 's3://my-sample-hookversion-bucket/my-sample-hook.zip' HookDefaultVersion: Type: 'AWS::CloudFormation::HookDefaultVersion' Properties: TypeVersionArn: !Ref HookVersion
Specifying a hook default version using TypeVersionArn
The following example demonstrates how to set a hook version as the default version through the
TypeVersionArn property type.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "HookDefaultVersion": { "Type": "AWS::CloudFormation::HookDefaultVersion", "Properties": { "TypeVersionArn": "arn:aws:cloudformation:us-west-2:123456789012:type/hook/My-Sample-Hook/00000001" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: HookDefaultVersion: Type: 'AWS::CloudFormation::HookDefaultVersion' Properties: TypeVersionArn: >- arn:aws:cloudformation:us-west-2:123456789012:type/hook/My-Sample-Hook/00000001
Specifying a hook default version using TypeName and VersionId
The following example demonstrates how to set a hook version as the default version through the
VersionId property type.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "HookDefaultVersion": { "Type": "AWS::CloudFormation::HookDefaultVersion", "Properties": { "TypeName": "My::Sample::Hook", "VersionId": 1 } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Resources: HookDefaultVersion: Type: 'AWS::CloudFormation::HookDefaultVersion' Properties: TypeName: 'My::Sample::Hook' VersionId: 1