Skip to content

Persistent diff with ignore_tags when the config applies a matching/ignored tag #18068

Closed as not planned
@lorengordon

Description

@lorengordon

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 other comments that do not add relevant new information or questions, 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 CLI and Terraform AWS Provider Version

$ terraform -v
Terraform v0.14.8
+ provider registry.terraform.io/hashicorp/aws v3.32.0

Affected Resource(s)

  • provider.ignore_tags

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

provider "aws" {
  ignore_tags {
    keys = ["Test"]
    key_prefixes = ["foo/"]
  }
}


resource "aws_vpc" "keys" {
  cidr_block = "10.0.0.0/16"

  tags = {
    Name = "testing-ignore-tags-keys"
    Test = "testing"
  }
}

resource "aws_vpc" "key_prefixes" {
  cidr_block = "10.0.0.0/16"

  tags = {
    Name      = "testing-ignore-tags-key-prefixes"
    "foo/bar" = "testing"
  }
}

Expected Behavior

Expected to apply the config, and that a subsequent plan would not display a diff.

Actual Behavior

Terraform wants to re-apply the matching ignored tags even when they are actually specified in the config.

$ terraform plan
aws_vpc.keys: Refreshing state... [id=vpc-0205908ff10822f9d]
aws_vpc.key_prefixes: Refreshing state... [id=vpc-079e089fa0b2b0dd1]

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_vpc.key_prefixes will be updated in-place
  ~ resource "aws_vpc" "key_prefixes" {
        id                               = "vpc-xxxxxx"
      ~ tags                             = {
          + "foo/bar" = "testing"
            # (1 unchanged element hidden)
        }
        # (14 unchanged attributes hidden)
    }

  # aws_vpc.keys will be updated in-place
  ~ resource "aws_vpc" "keys" {
        id                               = "vpc-xxxxxx"
      ~ tags                             = {
          + "Test" = "testing"
            # (1 unchanged element hidden)
        }
        # (14 unchanged attributes hidden)
    }

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

Steps to Reproduce

  1. terraform apply
  2. terraform plan

References

I checked but didn't see related issues or documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    service/ec2Issues and PRs that pertain to the ec2 service.staleOld or inactive issues managed by automation, if no further action taken these will get closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions