Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloudformation won't deploy changes when default param is changed

I have this template:

Parameters:
  ALBPort:
    Type: Number
    Description: The loab balancer port (how the app is accessed externally)
    Default: 8000 #changing this
  ...

Resources:
  ALBListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    DependsOn: MyALB
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn: !Ref TargetGroup
      LoadBalancerArn: !Ref MyALB
      Port: !Ref ALBPort #changing this
      Protocol: HTTP

I change the default value in the template but when i redeploy:

No changes to deploy. Stack mystack is up to date

If I change it statically like Port: 8001 CF sees the change

like image 392
red888 Avatar asked Jul 09 '18 16:07

red888


1 Answers

Changing the default parameter value doesn't change the existing parameter value in a stack(if the parameter already has a value). The default is only applied the first time you introduce the parameter in the stack(during stack creation or when you add a new parameter in a subsequent update). After that, you need to explicitly set the parameter value during updates.

At the time you redeploy, the stack already has the parameter ALBPort set to the previous value of default. So, your new default would only get applied when you create a new stack with the template. You need to set the value of ALBPort to your new value during the stack update operation.

like image 100
user818510 Avatar answered Oct 02 '22 20:10

user818510