Terraform ignore_changes for CodeDeployProvisioningDeploymentId tag

1.2k Views Asked by At

I'm using Terraform v0.12.25 with provider.aws v2.70.0. I have ASG resource defined in Terraform:

resource "aws_autoscaling_group" "web" {
  name                      = "CodeDeploy_production_web"
  max_size                  = 40
  min_size                  = 1
  wait_for_capacity_timeout = "0"
  health_check_type         = "EC2"
  desired_capacity          = 1
  launch_configuration      = aws_launch_configuration.web.name
  vpc_zone_identifier       = data.aws_subnet_ids.subnets.ids
  suspended_processes       = []
  tag {
      key                 = "Environment"
      propagate_at_launch = true
      value               = "production"
    }
  tag {
      key                 = "Name"
      propagate_at_launch = true
      value               = "Web_App_production_CD"
    }
  tag {
         key                 = "CodeDeployProvisioningDeploymentId"
         propagate_at_launch = true
         value               = ""
     }
  lifecycle {
      ignore_changes = [
        desired_capacity,
        name
      ]
    }
}

I want to ignore changes on tag "CodeDeployProvisioningDeploymentId". I've tried adding it to ignore_changes block but I didn't succeed in making it work. Does anyone know how to do this?

1

There are 1 best solutions below

0
On

There is an ignore_tags argument on the AWS provider. However for AWS provider v2.70.0 it says it doesn't work on aws_autoscaling_group resources. I am using AWS provider v3.75.0 and the documentation for that version doesn't exclude aws_autoscaling_group resources and I can confirm it works.

My provider now looks like this:

provider "aws" {
  version = "~> 3.75.0"
  region  = var.aws_region

  ignore_tags {
    keys = ["CodeDeployProvisioningDeploymentId"]
  }
}