Class: AWSCDK::CodePipelineActions::CloudFormationCreateUpdateStackActionProps

Inherits:
AWSCDK::Codepipeline::CommonAWSActionProps
  • Object
show all
Defined in:
code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb

Overview

Properties for the CloudFormationCreateUpdateStackAction.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action_name:, run_order: nil, variables_namespace: nil, role: nil, admin_permissions:, stack_name:, template_path:, account: nil, cfn_capabilities: nil, deployment_role: nil, extra_inputs: nil, output: nil, output_file_name: nil, parameter_overrides: nil, region: nil, replace_on_failure: nil, template_configuration: nil) ⇒ CloudFormationCreateUpdateStackActionProps

Returns a new instance of CloudFormationCreateUpdateStackActionProps.

Parameters:

  • action_name (String)

    The physical, human-readable name of the Action.

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

    The runOrder property for this Action.

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

    The name of the namespace to use for variables emitted by this action.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The Role in which context's this Action will be executing in.

  • admin_permissions (Boolean)

    Whether to grant full permissions to CloudFormation while deploying this template.

  • stack_name (String)

    The name of the stack to apply this action to.

  • template_path (AWSCDK::Codepipeline::ArtifactPath)

    Input artifact with the CloudFormation template to deploy.

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

    The AWS account this Action is supposed to operate in.

  • cfn_capabilities (Array<AWSCDK::CfnCapabilities>, nil) (defaults to: nil)

    Acknowledge certain changes made as part of deployment.

  • deployment_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    IAM role to assume when deploying changes.

  • extra_inputs (Array<AWSCDK::Codepipeline::Artifact>, nil) (defaults to: nil)

    The list of additional input Artifacts for this Action.

  • output (AWSCDK::Codepipeline::Artifact, nil) (defaults to: nil)

    The name of the output artifact to generate.

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

    A name for the filename in the output artifact to store the AWS CloudFormation call's result.

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

    Additional template parameters.

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

    The AWS region the given Action resides in.

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

    Replace the stack if it's in a failed state.

  • template_configuration (AWSCDK::Codepipeline::ArtifactPath, nil) (defaults to: nil)

    Input artifact to use for template parameters values and stack policy.



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
54
55
56
57
58
59
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 24

def initialize(action_name:, run_order: nil, variables_namespace: nil, role: nil, admin_permissions:, stack_name:, template_path:, account: nil, cfn_capabilities: nil, deployment_role: nil, extra_inputs: nil, output: nil, output_file_name: nil, parameter_overrides: nil, region: nil, replace_on_failure: nil, template_configuration: nil)
  @action_name = action_name
  Jsii::Type.check_type(@action_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actionName")
  @run_order = run_order
  Jsii::Type.check_type(@run_order, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "runOrder") unless @run_order.nil?
  @variables_namespace = variables_namespace
  Jsii::Type.check_type(@variables_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "variablesNamespace") unless @variables_namespace.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @admin_permissions = admin_permissions
  Jsii::Type.check_type(@admin_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "adminPermissions")
  @stack_name = stack_name
  Jsii::Type.check_type(@stack_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackName")
  @template_path = template_path
  Jsii::Type.check_type(@template_path, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLkFydGlmYWN0UGF0aCJ9")), "templatePath")
  @account = 
  Jsii::Type.check_type(@account, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "account") unless @account.nil?
  @cfn_capabilities = cfn_capabilities
  Jsii::Type.check_type(@cfn_capabilities, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmbkNhcGFiaWxpdGllcyJ9LCJraW5kIjoiYXJyYXkifX0=")), "cfnCapabilities") unless @cfn_capabilities.nil?
  @deployment_role = deployment_role
  Jsii::Type.check_type(@deployment_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "deploymentRole") unless @deployment_role.nil?
  @extra_inputs = extra_inputs
  Jsii::Type.check_type(@extra_inputs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlcGlwZWxpbmUuQXJ0aWZhY3QifSwia2luZCI6ImFycmF5In19")), "extraInputs") unless @extra_inputs.nil?
  @output = output
  Jsii::Type.check_type(@output, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLkFydGlmYWN0In0=")), "output") unless @output.nil?
  @output_file_name = output_file_name
  Jsii::Type.check_type(@output_file_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outputFileName") unless @output_file_name.nil?
  @parameter_overrides = parameter_overrides
  Jsii::Type.check_type(@parameter_overrides, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "parameterOverrides") unless @parameter_overrides.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
  @replace_on_failure = replace_on_failure
  Jsii::Type.check_type(@replace_on_failure, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "replaceOnFailure") unless @replace_on_failure.nil?
  @template_configuration = template_configuration
  Jsii::Type.check_type(@template_configuration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lLkFydGlmYWN0UGF0aCJ9")), "templateConfiguration") unless @template_configuration.nil?
end

Instance Attribute Details

#accountString? (readonly)

Note:

Default: - action resides in the same account as the pipeline

The AWS account this Action is supposed to operate in.

Note: if you specify the role property, this is ignored - the action will operate in the same region the passed role does.

Returns:

  • (String, nil)


122
123
124
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 122

def 
  @account
end

#action_nameString (readonly)

The physical, human-readable name of the Action.

Note that Action names must be unique within a single Stage.

Returns:

  • (String)


66
67
68
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 66

def action_name
  @action_name
end

#admin_permissionsBoolean (readonly)

Whether to grant full permissions to CloudFormation while deploying this template.

Setting this to true affects the defaults for role and capabilities, if you don't specify any alternatives.

The default role that will be created for you will have full (i.e., *) permissions on all resources, and the deployment will have named IAM capabilities (i.e., able to create all IAM resources).

This is a shorthand that you can use if you fully trust the templates that are deployed in this pipeline. If you want more fine-grained permissions, use add_to_role_policy and capabilities to control what the CloudFormation deployment is allowed to do.

Returns:

  • (Boolean)


106
107
108
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 106

def admin_permissions
  @admin_permissions
end

#cfn_capabilitiesArray<AWSCDK::CfnCapabilities>? (readonly)

Note:

Default: None, unless adminPermissions is true

Acknowledge certain changes made as part of deployment.

For stacks that contain certain resources, explicit acknowledgement is required that AWS CloudFormation might create or update those resources. For example, you must specify ANONYMOUS_IAM or NAMED_IAM if your stack template contains AWS Identity and Access Management (IAM) resources. For more information, see the link below.



134
135
136
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 134

def cfn_capabilities
  @cfn_capabilities
end

#deployment_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: A fresh role with full or no permissions (depending on the value of adminPermissions).

IAM role to assume when deploying changes.

If not specified, a fresh role is created. The role is created with zero permissions unless admin_permissions is true, in which case the role will have full permissions.

Returns:



143
144
145
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 143

def deployment_role
  @deployment_role
end

#extra_inputsArray<AWSCDK::Codepipeline::Artifact>? (readonly)

The list of additional input Artifacts for this Action.

This is especially useful when used in conjunction with the parameter_overrides property. For example, if you have:

parameterOverrides: { 'Param1': action1.outputArtifact.bucketName, 'Param2': action2.outputArtifact.objectKey, }

, if the output Artifacts of action1 and action2 were not used to set either the template_configuration or the template_path properties, you need to make sure to include them in the extra_inputs - otherwise, you'll get an "unrecognized Artifact" error during your Pipeline's execution.

Returns:



160
161
162
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 160

def extra_inputs
  @extra_inputs
end

#outputAWSCDK::Codepipeline::Artifact? (readonly)

Note:

Default: Automatically generated artifact name.

The name of the output artifact to generate.

Only applied if output_file_name is set as well.



167
168
169
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 167

def output
  @output
end

#output_file_nameString? (readonly)

Note:

Default: No output artifact generated

A name for the filename in the output artifact to store the AWS CloudFormation call's result.

The file will contain the result of the call to AWS CloudFormation (for example the call to UpdateStack or CreateChangeSet).

AWS CodePipeline adds the file to the output artifact after performing the specified action.

Returns:

  • (String, nil)


178
179
180
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 178

def output_file_name
  @output_file_name
end

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

Note:

Default: No overrides

Additional template parameters.

Template parameters specified here take precedence over template parameters found in the artifact specified by the template_configuration property.

We recommend that you use the template configuration file to specify most of your parameter values. Use parameter overrides to specify only dynamic parameter values (values that are unknown until you run the pipeline).

All parameter names must be present in the stack template.

Note: the entire object cannot be more than 1kB.

Returns:

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


195
196
197
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 195

def parameter_overrides
  @parameter_overrides
end

#regionString? (readonly)

Note:

Default: the Action resides in the same region as the Pipeline

The AWS region the given Action resides in.

Note that a cross-region Pipeline requires replication buckets to function correctly. You can provide their names with the PipelineProps#crossRegionReplicationBuckets property. If you don't, the CodePipeline Construct will create new Stacks in your CDK app containing those buckets, that you will need to cdk deploy before deploying the main, Pipeline-containing Stack.

Returns:

  • (String, nil)


205
206
207
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 205

def region
  @region
end

#replace_on_failureBoolean? (readonly)

Note:

Default: false

Replace the stack if it's in a failed state.

If this is set to true and the stack is in a failed state (one of ROLLBACK_COMPLETE, ROLLBACK_FAILED, CREATE_FAILED, DELETE_FAILED, or UPDATE_ROLLBACK_FAILED), AWS CloudFormation deletes the stack and then creates a new stack.

If this is not set to true and the stack is in a failed state, the deployment fails.

Returns:

  • (Boolean, nil)


218
219
220
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 218

def replace_on_failure
  @replace_on_failure
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: a new Role will be generated

The Role in which context's this Action will be executing in.

The Pipeline's Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your IAction.bind method in the ActionBindOptions.role property.

Returns:



90
91
92
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 90

def role
  @role
end

#run_orderNumeric? (readonly)

Note:

Default: 1

The runOrder property for this Action.

RunOrder determines the relative order in which multiple Actions in the same Stage execute.



74
75
76
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 74

def run_order
  @run_order
end

#stack_nameString (readonly)

The name of the stack to apply this action to.

Returns:

  • (String)


110
111
112
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 110

def stack_name
  @stack_name
end

#template_configurationAWSCDK::Codepipeline::ArtifactPath? (readonly)

Note:

Default: No template configuration based on input artifacts

Input artifact to use for template parameters values and stack policy.

The template configuration file should contain a JSON object that should look like this: { "Parameters": {...}, "Tags": {...}, "StackPolicy": {... }}. For more information, see AWS CloudFormation Artifacts.

Note that if you include sensitive information, such as passwords, restrict access to this file.



230
231
232
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 230

def template_configuration
  @template_configuration
end

#template_pathAWSCDK::Codepipeline::ArtifactPath (readonly)

Input artifact with the CloudFormation template to deploy.



114
115
116
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 114

def template_path
  @template_path
end

#variables_namespaceString? (readonly)

Note:

Default: - a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set

The name of the namespace to use for variables emitted by this action.

Returns:

  • (String, nil)


79
80
81
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 79

def variables_namespace
  @variables_namespace
end

Class Method Details

.jsii_propertiesObject



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 232

def self.jsii_properties
  {
    :action_name => "actionName",
    :run_order => "runOrder",
    :variables_namespace => "variablesNamespace",
    :role => "role",
    :admin_permissions => "adminPermissions",
    :stack_name => "stackName",
    :template_path => "templatePath",
    :account => "account",
    :cfn_capabilities => "cfnCapabilities",
    :deployment_role => "deploymentRole",
    :extra_inputs => "extraInputs",
    :output => "output",
    :output_file_name => "outputFileName",
    :parameter_overrides => "parameterOverrides",
    :region => "region",
    :replace_on_failure => "replaceOnFailure",
    :template_configuration => "templateConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'code_pipeline_actions/cloud_formation_create_update_stack_action_props.rb', line 254

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "actionName" => @action_name,
    "runOrder" => @run_order,
    "variablesNamespace" => @variables_namespace,
    "role" => @role,
    "adminPermissions" => @admin_permissions,
    "stackName" => @stack_name,
    "templatePath" => @template_path,
    "account" => @account,
    "cfnCapabilities" => @cfn_capabilities,
    "deploymentRole" => @deployment_role,
    "extraInputs" => @extra_inputs,
    "output" => @output,
    "outputFileName" => @output_file_name,
    "parameterOverrides" => @parameter_overrides,
    "region" => @region,
    "replaceOnFailure" => @replace_on_failure,
    "templateConfiguration" => @template_configuration,
  })
  result.compact
end