Class: AWSCDK::CloudAssemblySchema::AWSCloudFormationStackProperties

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_assembly_schema/aws_cloud_formation_stack_properties.rb

Overview

Artifact properties for CloudFormation stacks.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_file:, assume_role_additional_options: nil, assume_role_arn: nil, assume_role_external_id: nil, bootstrap_stack_version_ssm_parameter: nil, cloud_formation_execution_role_arn: nil, lookup_role: nil, notification_arns: nil, parameters: nil, requires_bootstrap_stack_version: nil, stack_name: nil, stack_template_asset_object_url: nil, tags: nil, termination_protection: nil, validate_on_synth: nil) ⇒ AWSCloudFormationStackProperties

Returns a new instance of AWSCloudFormationStackProperties.

Parameters:

  • template_file (String)

    A file relative to the assembly root which contains the CloudFormation template for this stack.

  • assume_role_additional_options (Hash{String => Object}, nil) (defaults to: nil)

    Additional options to pass to STS when assuming the role.

  • assume_role_arn (String, nil) (defaults to: nil)

    The role that needs to be assumed to deploy the stack.

  • assume_role_external_id (String, nil) (defaults to: nil)

    External ID to use when assuming role for cloudformation deployments.

  • bootstrap_stack_version_ssm_parameter (String, nil) (defaults to: nil)

    SSM parameter where the bootstrap stack version number can be found.

  • cloud_formation_execution_role_arn (String, nil) (defaults to: nil)

    The role that is passed to CloudFormation to execute the change set.

  • lookup_role (AWSCDK::CloudAssemblySchema::BootstrapRole, nil) (defaults to: nil)

    The role to use to look up values from the target AWS account.

  • notification_arns (Array<String>, nil) (defaults to: nil)

    SNS Notification ARNs that should receive CloudFormation Stack Events.

  • parameters (Hash{String => String}, nil) (defaults to: nil)

    Values for CloudFormation stack parameters that should be passed when the stack is deployed.

  • requires_bootstrap_stack_version (Numeric, nil) (defaults to: nil)

    Version of bootstrap stack required to deploy this stack.

  • stack_name (String, nil) (defaults to: nil)

    The name to use for the CloudFormation stack.

  • stack_template_asset_object_url (String, nil) (defaults to: nil)

    If the stack template has already been included in the asset manifest, its asset URL.

  • tags (Hash{String => String}, nil) (defaults to: nil)

    Values for CloudFormation stack tags that should be passed when the stack is deployed.

  • termination_protection (Boolean, nil) (defaults to: nil)

    Whether to enable termination protection for this stack.

  • validate_on_synth (Boolean, nil) (defaults to: nil)

    Whether this stack should be validated by the CLI after synthesis.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 22

def initialize(template_file:, assume_role_additional_options: nil, assume_role_arn: nil, assume_role_external_id: nil, bootstrap_stack_version_ssm_parameter: nil, cloud_formation_execution_role_arn: nil, lookup_role: nil, notification_arns: nil, parameters: nil, requires_bootstrap_stack_version: nil, stack_name: nil, stack_template_asset_object_url: nil, tags: nil, termination_protection: nil, validate_on_synth: nil)
  @template_file = template_file
  Jsii::Type.check_type(@template_file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "templateFile")
  @assume_role_additional_options = assume_role_additional_options
  Jsii::Type.check_type(@assume_role_additional_options, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "assumeRoleAdditionalOptions") unless @assume_role_additional_options.nil?
  @assume_role_arn = assume_role_arn
  Jsii::Type.check_type(@assume_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assumeRoleArn") unless @assume_role_arn.nil?
  @assume_role_external_id = assume_role_external_id
  Jsii::Type.check_type(@assume_role_external_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assumeRoleExternalId") unless @assume_role_external_id.nil?
  @bootstrap_stack_version_ssm_parameter = bootstrap_stack_version_ssm_parameter
  Jsii::Type.check_type(@bootstrap_stack_version_ssm_parameter, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bootstrapStackVersionSsmParameter") unless @bootstrap_stack_version_ssm_parameter.nil?
  @cloud_formation_execution_role_arn = cloud_formation_execution_role_arn
  Jsii::Type.check_type(@cloud_formation_execution_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cloudFormationExecutionRoleArn") unless @cloud_formation_execution_role_arn.nil?
  @lookup_role = lookup_role.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::BootstrapRole.new(**lookup_role.transform_keys(&:to_sym)) : lookup_role
  Jsii::Type.check_type(@lookup_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuQm9vdHN0cmFwUm9sZSJ9")), "lookupRole") unless @lookup_role.nil?
  @notification_arns = notification_arns
  Jsii::Type.check_type(@notification_arns, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "notificationArns") unless @notification_arns.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "parameters") unless @parameters.nil?
  @requires_bootstrap_stack_version = requires_bootstrap_stack_version
  Jsii::Type.check_type(@requires_bootstrap_stack_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "requiresBootstrapStackVersion") unless @requires_bootstrap_stack_version.nil?
  @stack_name = stack_name
  Jsii::Type.check_type(@stack_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackName") unless @stack_name.nil?
  @stack_template_asset_object_url = stack_template_asset_object_url
  Jsii::Type.check_type(@stack_template_asset_object_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackTemplateAssetObjectUrl") unless @stack_template_asset_object_url.nil?
  @tags = tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "tags") unless @tags.nil?
  @termination_protection = termination_protection
  Jsii::Type.check_type(@termination_protection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "terminationProtection") unless @termination_protection.nil?
  @validate_on_synth = validate_on_synth
  Jsii::Type.check_type(@validate_on_synth, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "validateOnSynth") unless @validate_on_synth.nil?
end

Instance Attribute Details

#assume_role_additional_optionsHash{String => Object}? (readonly)

Note:

Default: - No additional options.

Additional options to pass to STS when assuming the role.

  • RoleArn should not be used. Use the dedicated assume_role_arn property instead.
  • ExternalId should not be used. Use the dedicated assume_role_external_id instead.


67
68
69
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 67

def assume_role_additional_options
  @assume_role_additional_options
end

#assume_role_arnString? (readonly)

Note:

Default: - No role is assumed (current credentials are used)

The role that needs to be assumed to deploy the stack.

Returns:

  • (String, nil)


72
73
74
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 72

def assume_role_arn
  @assume_role_arn
end

#assume_role_external_idString? (readonly)

Note:

Default: - No external ID

External ID to use when assuming role for cloudformation deployments.

Returns:

  • (String, nil)


77
78
79
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 77

def assume_role_external_id
  @assume_role_external_id
end

#bootstrap_stack_version_ssm_parameterString? (readonly)

Note:

Default: - Bootstrap stack version number looked up

SSM parameter where the bootstrap stack version number can be found.

Only used if requires_bootstrap_stack_version is set.

  • If this value is not set, the bootstrap stack name must be known at deployment time so the stack version can be looked up from the stack outputs.
  • If this value is set, the bootstrap stack can have any name because we won't need to look it up.

Returns:

  • (String, nil)


90
91
92
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 90

def bootstrap_stack_version_ssm_parameter
  @bootstrap_stack_version_ssm_parameter
end

#cloud_formation_execution_role_arnString? (readonly)

Note:

Default: - No role is passed (currently assumed role/credentials are used)

The role that is passed to CloudFormation to execute the change set.

Returns:

  • (String, nil)


95
96
97
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 95

def cloud_formation_execution_role_arn
  @cloud_formation_execution_role_arn
end

#lookup_roleAWSCDK::CloudAssemblySchema::BootstrapRole? (readonly)

Note:

Default: - No role is assumed (current credentials are used)

The role to use to look up values from the target AWS account.



100
101
102
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 100

def lookup_role
  @lookup_role
end

#notification_arnsArray<String>? (readonly)

Note:

Default: - No notification arns

SNS Notification ARNs that should receive CloudFormation Stack Events.

Returns:

  • (Array<String>, nil)


105
106
107
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 105

def notification_arns
  @notification_arns
end

#parametersHash{String => String}? (readonly)

Note:

Default: - No parameters

Values for CloudFormation stack parameters that should be passed when the stack is deployed.

Returns:

  • (Hash{String => String}, nil)


110
111
112
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 110

def parameters
  @parameters
end

#requires_bootstrap_stack_versionNumeric? (readonly)

Note:

Default: - No bootstrap stack required

Version of bootstrap stack required to deploy this stack.

Returns:

  • (Numeric, nil)


115
116
117
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 115

def requires_bootstrap_stack_version
  @requires_bootstrap_stack_version
end

#stack_nameString? (readonly)

Note:

Default: - name derived from artifact ID

The name to use for the CloudFormation stack.

Returns:

  • (String, nil)


120
121
122
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 120

def stack_name
  @stack_name
end

#stack_template_asset_object_urlString? (readonly)

Note:

Default: - Not uploaded yet, upload just before deploying

If the stack template has already been included in the asset manifest, its asset URL.

Returns:

  • (String, nil)


125
126
127
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 125

def stack_template_asset_object_url
  @stack_template_asset_object_url
end

#tagsHash{String => String}? (readonly)

Note:

Default: - No tags

Values for CloudFormation stack tags that should be passed when the stack is deployed.

N.B.: Tags are also written to stack metadata, under the path of the Stack construct. Only in CDK CLI v1 are those tags found in metadata used for actual deployments; in all stable versions of CDK only the stack tags directly found in the tags property of AwsCloudFormationStack artifact (i.e., this property) are used.

Returns:

  • (Hash{String => String}, nil)


136
137
138
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 136

def tags
  @tags
end

#template_fileString (readonly)

A file relative to the assembly root which contains the CloudFormation template for this stack.

Returns:

  • (String)


58
59
60
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 58

def template_file
  @template_file
end

#termination_protectionBoolean? (readonly)

Note:

Default: false

Whether to enable termination protection for this stack.

Returns:

  • (Boolean, nil)


141
142
143
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 141

def termination_protection
  @termination_protection
end

#validate_on_synthBoolean? (readonly)

Note:

Default: - false

Whether this stack should be validated by the CLI after synthesis.

Returns:

  • (Boolean, nil)


146
147
148
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 146

def validate_on_synth
  @validate_on_synth
end

Class Method Details

.jsii_propertiesObject



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 148

def self.jsii_properties
  {
    :template_file => "templateFile",
    :assume_role_additional_options => "assumeRoleAdditionalOptions",
    :assume_role_arn => "assumeRoleArn",
    :assume_role_external_id => "assumeRoleExternalId",
    :bootstrap_stack_version_ssm_parameter => "bootstrapStackVersionSsmParameter",
    :cloud_formation_execution_role_arn => "cloudFormationExecutionRoleArn",
    :lookup_role => "lookupRole",
    :notification_arns => "notificationArns",
    :parameters => "parameters",
    :requires_bootstrap_stack_version => "requiresBootstrapStackVersion",
    :stack_name => "stackName",
    :stack_template_asset_object_url => "stackTemplateAssetObjectUrl",
    :tags => "tags",
    :termination_protection => "terminationProtection",
    :validate_on_synth => "validateOnSynth",
  }
end

Instance Method Details

#to_jsiiObject



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'cloud_assembly_schema/aws_cloud_formation_stack_properties.rb', line 168

def to_jsii
  result = {}
  result.merge!({
    "templateFile" => @template_file,
    "assumeRoleAdditionalOptions" => @assume_role_additional_options,
    "assumeRoleArn" => @assume_role_arn,
    "assumeRoleExternalId" => @assume_role_external_id,
    "bootstrapStackVersionSsmParameter" => @bootstrap_stack_version_ssm_parameter,
    "cloudFormationExecutionRoleArn" => @cloud_formation_execution_role_arn,
    "lookupRole" => @lookup_role,
    "notificationArns" => @notification_arns,
    "parameters" => @parameters,
    "requiresBootstrapStackVersion" => @requires_bootstrap_stack_version,
    "stackName" => @stack_name,
    "stackTemplateAssetObjectUrl" => @stack_template_asset_object_url,
    "tags" => @tags,
    "terminationProtection" => @termination_protection,
    "validateOnSynth" => @validate_on_synth,
  })
  result.compact
end