Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification of aws_launch_template doesn't trigger modification of aws_cloudformation_stack when aws_launch_template.*.latest_version is used in this aws_cloudformation_stack #5273

Closed
Defozo opened this issue Jul 20, 2018 · 3 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@Defozo
Copy link

Defozo commented Jul 20, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.7

  • provider.aws v1.28.0

Affected Resource(s)

  • aws_cloudformation_stack
  • aws_launch_template

Terraform Configuration Files

resource "aws_launch_template" "photon" {
  name = "photon"

  credit_specification {
    cpu_credits = "unlimited"
  }

  iam_instance_profile {
    name = "photon"
  }

  vpc_security_group_ids = ["sg-1235f274"]

  image_id = "${data.aws_ami.photon_ami.id}"

  instance_initiated_shutdown_behavior = "terminate"

  instance_type = "t2.micro"

  key_name = "BackEndKeyPair"

  tag_specifications {
    resource_type = "instance"
    tags {
      Name = "Photon"
      Application = "Photon"
    }
  }
}

resource "aws_cloudformation_stack" "autoscaling_group" {
  depends_on = ["aws_launch_template.photon"]
  name = "photon"
  template_body = <<EOF
{
  "Resources": {
    "photon": {
      "Type": "AWS::AutoScaling::AutoScalingGroup",
      "Properties": {
        "AutoScalingGroupName": "photon",
        "AvailabilityZones": ["eu-west-1a", "eu-west-1b", "eu-west-1c"],
        "LaunchTemplate": {
          "LaunchTemplateId" : "${aws_launch_template.photon.id}",
          "Version" : "${aws_launch_template.photon.latest_version}"
        },
        "MaxSize": "4",
        "MinSize": "2",
        "TargetGroupARNs": ["${aws_lb_target_group.photon.arn}"],
        "TerminationPolicies": ["OldestLaunchConfiguration", "OldestInstance"],
        "HealthCheckType": "ELB",
        "HealthCheckGracePeriod": 300
      },
      "UpdatePolicy": {
        "AutoScalingRollingUpdate": {
          "MinInstancesInService": "2",
          "MaxBatchSize": "2",
          "PauseTime": "PT0S"
        }
      }
    }
  },
  "Outputs": {
    "photon": {
      "Description": "The name of the auto scaling group",
       "Value": {"Ref": "photon"}
    }
  }
}
EOF
}

Expected Behavior

CloudFormation Stack should get updated.

Actual Behavior

Only aws_launch_template got updated. aws_cloudformation_stack would get updated if I run terraform apply again.

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ aws_launch_template.photon
      vpc_security_group_ids.#:          "0" => "1"
      vpc_security_group_ids.3213257969: "" => "sg-1235f274"


Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  • Create terraform file with aws_cloudformation_stack and aws_launch_template. Use aws_launch_template.*.latest_version in aws_cloudformation_stack.

  • Execute terraform apply.

  • Change something (eg. vpc_security_group_ids or image_id) in aws_launch_template.

  • Execute terraform apply.
    Result: Only aws_launch_template will get changed.

  • Execute terraform apply again.
    Result: aws_cloudformation_stack will get changed.

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jul 27, 2018
@gordonbondon
Copy link
Contributor

Wasn't this fixed in #5250 and released in 1.30 ?

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Aug 18, 2020
@ghost
Copy link

ghost commented Oct 18, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

3 participants