Amazon Web Services (AWS) resources tags are metadata labels with keys and optional values used to categorize and manage resources.

Why is this an issue?

Proper tagging enhances resource discovery, lifecycle management, and overall productivity within the AWS environment. If tags do not comply with the AWS format, it can lead to confusion and inefficiency in managing resources, as well as unexpected behavior of the system.

AWS resource tags should comply with the format stated in AWS documentation. That is, tag keys should:

How to fix it

Code examples

Noncompliant code example

resource "aws_s3_bucket" "examplebucket" {
  bucket = "mybucketname"

  tags = {
    "anycompany:~cost-center~" = "Accounting"
  }
}

Compliant solution

resource "aws_s3_bucket" "examplebucket" {
  bucket = "mybucketname"

  tags = {
    "anycompany:cost-center" = "Accounting"
  }
}

Resources

Documentation