更改默认参数后,Cloudformation不会部署更改

时间:2018-07-09 16:02:10

标签: amazon-web-services amazon-cloudformation

我有这个模板:

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

我更改了模板中的默认值,但是当我重新部署时:

No changes to deploy. Stack mystack is up to date

如果我像Port: 8001那样静态地更改它,CF就会看到更改

1 个答案:

答案 0 :(得分:4)

更改默认参数值不会更改堆栈中现有的参数值(如果参数已经具有值)。默认设置仅在您第一次在堆栈中引入参数时使用(在堆栈创建期间或在后续更新中添加新参数时)。之后,您需要在更新期间显式设置参数值。

在重新部署时,堆栈已将参数ALBPort设置为默认的先前值。因此,只有在使用模板创建新堆栈时,才会应用新的默认值。您需要在堆栈更新操作期间将ALBPort的值设置为新值。