Skip to content

[Bug]: default_tags not applied to direct connect resources #40315

@bjorn-stange-expel

Description

@bjorn-stange-expel

Terraform Core Version

1.9.5

AWS Provider Version

5.61.0

Affected Resource(s)

  • aws_dx_transit_virtual_interface
  • aws_dx_connection

Expected Behavior

The tags in the provider's default_tags configuration should be applied to these resources.

Actual Behavior

No tags were applied

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

terraform.tf

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.61"

    }
  }
  required_version = "~> 1.9.5"

  backend "gcs" {
    bucket = "example"
    prefix = "example"
  }
}

provider "aws" {
  profile = "example"
  region  = local.aws_region
  default_tags {
    tags = local.default_tags
  }
}

locals.tf

locals {
  aws_region                = "us-east-1"
  environment               = "testing"

  default_tags = {
    "owner"        = "example_team"
    "environment"  = local.environment
  }
}

direct_connect.tf

data "aws_dx_connection" "megaport_connection" {
  name = "example"
}

resource "aws_dx_connection" "hoge" {
  name      = "tf-dx-connection"
  bandwidth = "1Gbps"
  location  = "EqDC2"
}

resource "aws_dx_gateway" "example" {
  name            = "tf-dxg-example"
  amazon_side_asn = 64512
}

resource "aws_dx_transit_virtual_interface" "example" {
  connection_id = aws_dx_connection.hoge.id

  dx_gateway_id  = aws_dx_gateway.example.id
  name           = "tf-transit-vif-example"
  vlan           = 4094
  address_family = "ipv4"
  bgp_asn        = 65352
}

Steps to Reproduce

Create AWS direct connect resources using the provider. Observe that default_tags are not applied to the direct connect resources that support tagging.

As a workaround I have manually added the tags field to each resource, which does apply the tags. My expectation is that the default_tags are applied.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/directconnectIssues and PRs that pertain to the directconnect 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