Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,883
Community Members
 
Community Events
176
Community Groups

aws cloudformation use previous value stack parameter

I have the need to update a cloudformation stack with some new parameters. I would like to do that using the aws cloudformation pipe like this:

script:
  - pipe: atlassian/aws-cloudformation-deploy:0.13.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_DEFAULT_REGION: 'us-east-1'
      STACK_NAME: 'my-stack-name'
      TEMPLATE: 'https://s3.amazonaws.com/cfn-deploy-pipe/cfn-template.json'
      STACK_PARAMETERS: >
          [{
            "ParameterKey": "KeyName",
            "ParameterValue": "mykey"
          },
          {
            "ParameterKey": "DBUser",
            "ParameterValue": "mydbuser"
          },
          {
            "ParameterKey": "DBPassword",
            "ParameterValue": $DB_PASSWORD

But I also have parameters that I won't define in my pipeline and simply use what the previous value was for the parameter, which I would have setup manually through the aws console. This is how I would do it using the aws cli:

aws cloudformation update-stack --stack-name stack-name --use-previous-template --parameters ParameterKey=KeyName,ParameterValue=mykey ParameterKey=DBPassword,UsePreviousValue=true

 Does the aws cloudformation pipe support the use of previous values in the STACK_PARAMETERS option?

1 answer

0 votes

@Adam Whiteland hi. Thanks for your question.

You should use extra parameters:

script:
  - pipe: atlassian/aws-cloudformation-deploy:0.13.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_DEFAULT_REGION: 'us-east-1'
      STACK_NAME: 'my-stack-name'
      TEMPLATE: 'https://s3.amazonaws.com/cfn-deploy-pipe/cfn-template.json'
      STACK_PARAMETERS: >
          [{
            "ParameterKey": "KeyName",
            "ParameterValue": "mykey"
          },
          {
            "ParameterKey": "DBUser",
            "ParameterValue": "mydbuser"
          },
          {
            "ParameterKey": "DBPassword",
            "ParameterValue": $DB_PASSWORD
}]
EXTRA_PARAMETERS: > { "UsePreviousTemplate": true
}

Regards, Igor

I don't think UsePreviousTemplate (for a stack) and UsePreviousValue (for a stack param) are the same.

This is how they are different:

You don't need to specify the template if you use UsePreviousTemplate.

You don't need to specify the parameter value if you use UsePreviousValue.

 

I couldn't find any doc on the cloudformation pipe which clearly says that UsePreviousValue is supported.

 

Can you please specify some link to a doc to verify this?

Like Adam Whiteland likes this

@Ashish Kataria hi. Our pipe based on boto3 implementation.
Here is link to boto3 cloudformation update stack.
In pipe it should work something like this:

      EXTRA_PARAMETERS: >
        {
            "UsePreviousTemplate": true,
"Parameters":[ { 'ParameterKey': 'string', 'ParameterValue': 'string', 'UsePreviousValue': True|False, 'ResolvedValue': 'string' } ]
}

Also link to amazon guide

Regards, Igor

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events