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

aws_autoscaling_group tag is changed on every apply #1597

Closed
hashibot opened this issue Sep 6, 2017 · 4 comments
Closed

aws_autoscaling_group tag is changed on every apply #1597

hashibot opened this issue Sep 6, 2017 · 4 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.

Comments

@hashibot
Copy link

hashibot commented Sep 6, 2017

This issue was originally opened by @moonyoungheo as hashicorp/terraform#16026. It was migrated here as a result of the provider split. The original body of the issue is below.


Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

If your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers .

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed.

$ terraform -v
Terraform v0.10.2

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
#
# For large Terraform configs, please use a service like Dropbox and
# share a link to the ZIP file. For security, you can also encrypt the
# files using our GPG public key.
resource "aws_autoscaling_group" "default" {
  name = "asg-${var.region_id}-${var.environment}-${var.name}-vpc${var.vpc_no}-${var.application}-001"

  availability_zones   = ["${var.availability_zones}"]
  vpc_zone_identifier  = ["${var.private_app_subnet_ids}"]
  launch_configuration = "${aws_launch_configuration.default.id}"
  min_size             = "${var.min_size}"
  max_size             = "${var.max_size}"
  desired_capacity     = "${var.desired_capacity}"
  enabled_metrics      = ["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]

  tag {
    key                 = "Name"
    value               = "ec2-${var.region_id}-${var.environment}-${var.name}-vpc${var.vpc_no}-${var.application}-001"
    propagate_at_launch = true
  }

  tag {
    key                 = "ApplicationService"
    value               = "${var.application_service}"
    propagate_at_launch = true
  }

  tag {
    key                 = "ApplicationRole"
    value               = "AutoScalingGroup"
    propagate_at_launch = true
  }

  tag {
    key                 = "Cluster"
    value               = "n"
    propagate_at_launch = true
  }

  tag {
    key                 = "Environment"
    value               = "${var.environment}"
    propagate_at_launch = true
  }

  tag {
    key                 = "Version"
    value               = "001"
    propagate_at_launch = true
  }

  tag {
    key                 = "BuildDate"
    value               = "${var.build_date}"
    propagate_at_launch = true
  }

  tag {
    key                 = "AutomationDateTime"
    value               = "N/A"
    propagate_at_launch = true
  }

  tag {
    key                 = "AutomationOptinOptout"
    value               = "n"
    propagate_at_launch = true
  }

  tag {
    key                 = "Owner"
    value               = "Platform"
    propagate_at_launch = true
  }

  tag {
    key                 = "BusinessUnit"
    value               = "Platform"
    propagate_at_launch = true
  }

  tag {
    key                 = "Project"
    value               = "Platform"
    propagate_at_launch = true
  }

  tag {
    key                 = "Region"
    value               = "${var.region}"
    propagate_at_launch = true
  }

  tag {
    key                 = "Confidentiality"
    value               = "Highly Confidential"
    propagate_at_launch = true
  }

  tag {
    key                 = "Confidentiality"
    value               = "AutoScalingGroup"
    propagate_at_launch = true
  }

  tag {
    key                 = "Compliance"
    value               = "PCI"
    propagate_at_launch = true
  }

  lifecycle {
    create_before_destroy = true
  }
}

Debug Output

Full debug output can be obtained by running Terraform with the environment variable TF_LOG=trace. Please create a GitHub Gist containing the debug output. Please do not paste the debug output in the issue, since debug output is long.

Debug output may contain sensitive information. Please review it before posting publicly, and if you are concerned feel free to encrypt the files using the HashiCorp security public key.

Crash Output

If the console output indicates that Terraform crashed, please share a link to a GitHub Gist containing the output of the crash.log file.

Expected Behavior

What should have happened?

Template has not been changed anything so aws_autoscaling_group tag must not be changed on every change

Actual Behavior

What actually happened?

  ~ module.ecs_cluster.aws_autoscaling_group.default
      tag.#:                              "15" => "16"
      tag.1001254645.key:                 "Compliance" => "Compliance"
      tag.1001254645.propagate_at_launch: "true" => "true"
      tag.1001254645.value:               "PCI" => "PCI"
      tag.1030868569.key:                 "AutomationOptinOptout" => "AutomationOptinOptout"
      tag.1030868569.propagate_at_launch: "true" => "true"
      tag.1030868569.value:               "n" => "n"
      tag.1302504204.key:                 "Owner" => "Owner"
      tag.1302504204.propagate_at_launch: "true" => "true"
      tag.1302504204.value:               "Platform" => "Platform"
      tag.1659509620.key:                 "" => "Confidentiality"
      tag.1659509620.propagate_at_launch: "" => "true"
      tag.1659509620.value:               "" => "Highly Confidential"
      tag.1672063264.key:                 "Confidentiality" => "Confidentiality"
      tag.1672063264.propagate_at_launch: "true" => "true"
      tag.1672063264.value:               "AutoScalingGroup" => "AutoScalingGroup"
      tag.1913245155.key:                 "Project" => "Project"
      tag.1913245155.propagate_at_launch: "true" => "true"
      tag.1913245155.value:               "Platform" => "Platform"
      tag.1918643764.key:                 "Region" => "Region"
      tag.1918643764.propagate_at_launch: "true" => "true"
      tag.1918643764.value:               "eu-west-1" => "eu-west-1"
      tag.2058228540.key:                 "BuildDate" => "BuildDate"
      tag.2058228540.propagate_at_launch: "true" => "true"
      tag.2058228540.value:               "20170712" => "20170712"
      tag.2067016155.key:                 "ApplicationRole" => "ApplicationRole"
      tag.2067016155.propagate_at_launch: "true" => "true"
      tag.2067016155.value:               "AutoScalingGroup" => "AutoScalingGroup"
      tag.2071688994.key:                 "Name" => "Name"
      tag.2071688994.propagate_at_launch: "true" => "true"
      tag.2071688994.value:               "ec2-euw1-dev-commercial-vpc001-spint-001" => "ec2-euw1-dev-commercial-vpc001-spint-001"
      tag.337936437.key:                  "BusinessUnit" => "BusinessUnit"
      tag.337936437.propagate_at_launch:  "true" => "true"
      tag.337936437.value:                "Platform" => "Platform"
      tag.395285238.key:                  "Version" => "Version"
      tag.395285238.propagate_at_launch:  "true" => "true"
      tag.395285238.value:                "001" => "001"
      tag.501627836.key:                  "ApplicationService" => "ApplicationService"
      tag.501627836.propagate_at_launch:  "true" => "true"
      tag.501627836.value:                "shared" => "shared"
      tag.776695200.key:                  "Environment" => "Environment"
      tag.776695200.propagate_at_launch:  "true" => "true"
      tag.776695200.value:                "dev" => "dev"
      tag.899351132.key:                  "AutomationDateTime" => "AutomationDateTime"
      tag.899351132.propagate_at_launch:  "true" => "true"
      tag.899351132.value:                "N/A" => "N/A"
      tag.970032257.key:                  "Cluster" => "Cluster"
      tag.970032257.propagate_at_launch:  "true" => "true"
      tag.970032257.value:                "n" => "n"


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

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform apply

Important Factoids

Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@hashibot hashibot added the bug Addresses a defect in current functionality. label Sep 6, 2017
@radeksimko radeksimko added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. and removed bug Addresses a defect in current functionality. labels Oct 11, 2017
@radeksimko
Copy link
Member

Hi,
this is caused by duplicate Confidentiality tag in your config, which the (admittedly not easy to read) diff shows:

      tag.1659509620.key:                 "" => "Confidentiality"
      tag.1659509620.propagate_at_launch: "" => "true"
      tag.1659509620.value:               "" => "Highly Confidential"
      tag.1672063264.key:                 "Confidentiality" => "Confidentiality"
      tag.1672063264.propagate_at_launch: "true" => "true"
      tag.1672063264.value:               "AutoScalingGroup" => "AutoScalingGroup"

and it's visible in your config too:

  tag {
    key                 = "Confidentiality"
    value               = "Highly Confidential"
    propagate_at_launch = true
  }

  tag {
    key                 = "Confidentiality"
    value               = "AutoScalingGroup"
    propagate_at_launch = true
  }

AWS API doesn't allow duplicate tags in this context, so removing one or the other should help.

That said we could and should perform validation of the tag field and tell the user there's duplicates before submitting it to the API. We don't support validation of complex (Set, List) fields like tag yet though. Tagging appropriately.

@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. upstream-terraform Addresses functionality related to the Terraform core binary. and removed question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. labels Oct 11, 2017
@moonyoungheo
Copy link

Thank you for your update

@radeksimko radeksimko added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Jan 28, 2018
@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 Mar 30, 2020
@ghost
Copy link

ghost commented May 31, 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 and limited conversation to collaborators May 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

No branches or pull requests

3 participants