Skip to content

[Bug]: [v4.66.1] aws_appautoscaling_target pollutes terraform plan when using default tags #31261

@mkielar

Description

@mkielar

Terraform Core Version

1.4.2

AWS Provider Version

4.66.1

Affected Resource(s)

  • aws_appautoscaling_target

Expected Behavior

After terraform apply, terraform plan should stop showing changes in tags_all attribute.

Actual Behavior

terraform plan keeps showing this change after terraform apply has already been applied on this change:

  # module.workload_baseline.aws_appautoscaling_target.msk_storage will be updated in-place
  ~ resource "aws_appautoscaling_target" "msk_storage" {
        id                 = "arn:aws:kafka:eu-west-1:[MASKED]:cluster/dev/[MASKED]"
        tags               = {}
      ~ tags_all           = {
          + "Env"       = "dev"
          + "ManagedBy" = "terraform"
          + "Service"   = "infra"
        }
        # (6 unchanged attributes hidden)
    }

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

The resource:

resource "aws_appautoscaling_policy" "msk_storage" {
  name               = "${aws_msk_cluster.this.cluster_name}-broker-scaling"
  policy_type        = "TargetTrackingScaling"
  resource_id        = aws_msk_cluster.this.arn
  scalable_dimension = aws_appautoscaling_target.msk_storage.scalable_dimension
  service_namespace  = aws_appautoscaling_target.msk_storage.service_namespace

  target_tracking_scaling_policy_configuration {
    predefined_metric_specification {
      predefined_metric_type = "KafkaBrokerStorageUtilization"
    }

    target_value = var.msk.storage_autoscaling.utilization_target
  }
}

Provider configuration

provider "aws" {
  region = var.region

  assume_role {
    role_arn = "arn:aws:iam::506501033716:role/infrastructure-deployer"
  }

  default_tags {
    tags = var.tags
  }
}

tags variable is set up as follows:

tags = {
  "Env"       = "dev",
  "Service"   = "infra",
  "ManagedBy" = "terraform",
}

Steps to Reproduce

  1. Run terraform plan after upgrading from 4.65 to 4.66.1, and observe the change in tags_all
  2. Run terraform apply - it seems to be updating the resource.
  3. Run terraform plan again, and observe the change in tags_all pops up again.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/appautoscalingIssues and PRs that pertain to the appautoscaling service.tagsPertains to resource tagging.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions