Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set tags on network resources since 1.64 #5258

Closed
lra opened this issue Apr 3, 2024 · 7 comments
Closed

Unable to set tags on network resources since 1.64 #5258

lra opened this issue Apr 3, 2024 · 7 comments
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure

Comments

@lra
Copy link

lra commented Apr 3, 2024

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 IBM Provider Version

Terraform v1.7.5
on darwin_arm64
+ provider registry.terraform.io/ibm-cloud/ibm v1.64.0

Affected Resource(s)

  • ibm_is_floating_ip
  • ibm_is_public_gateway
  • ibm_is_subnet
  • ibm_is_vpc

Terraform Configuration Files

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

locals {
  tags = [
    "environment:${var.environment}",
    "team:cloud",
    "cost-center:cloud-engineering",
  ]
}

resource "ibm_is_vpc" "vpc" {
  name                        = "${local.stack_name}-vpc"
  resource_group              = var.resource_group_id
  address_prefix_management   = "manual"
  default_network_acl_name    = "${local.stack_name}-default-acl"
  default_routing_table_name  = "${local.stack_name}-default-routing-table"
  default_security_group_name = "${local.stack_name}-default-sg"
  tags                        = local.tags
}

resource "ibm_is_floating_ip" "fip" {
  for_each       = toset(var.zone_names)
  name           = "${local.stack_name}-gateway-ip-${each.key}"
  resource_group = var.resource_group_id
  zone           = each.key
  tags           = local.tags
}

resource "ibm_is_public_gateway" "gateway" {
  for_each       = toset(var.zone_names)
  name           = "${local.stack_name}-gateway-${each.key}"
  resource_group = var.resource_group_id
  vpc            = ibm_is_vpc.vpc.id
  zone           = each.key
  floating_ip = {
    id = ibm_is_floating_ip.fip[each.key].id
  }
  tags = local.tags
}

Debug Output

Panic Output

Expected Behavior

$ terraform plan
No changes. Your infrastructure matches the configuration.

Actual Behavior

$ terraform plan

  # module.stack.module.vpc.ibm_is_floating_ip.fip["us-south-1"] will be updated in-place
  ~ resource "ibm_is_floating_ip" "fip" {
      ~ tags                    = [
          + "cost-center:cloud-engineering",
          + "environment:dev",
          + "team:cloud",
        ]
        # (13 unchanged attributes hidden)
    }
...
  # module.stack.module.vpc.ibm_is_public_gateway.gateway["us-south-1"] will be updated in-place
  ~ resource "ibm_is_public_gateway" "gateway" {
        id                      = "..."
        name                    = "..."
      ~ tags                    = [
          + "cost-center:cloud-engineering",
          + "environment:dev",
          + "team:cloud",
        ]
        # (12 unchanged attributes hidden)
    }
...
  # module.stack.module.vpc.ibm_is_subnet.subnet["us-south-3"] will be updated in-place
  ~ resource "ibm_is_subnet" "subnet" {
        id                           = "..."
        name                         = "..."
      ~ tags                         = [
          + "cost-center:cloud-engineering",
          + "environment:dev",
          + "team:cloud",
        ]
        # (18 unchanged attributes hidden)
    }

  # module.stack.module.vpc.ibm_is_vpc.vpc will be updated in-place
  ~ resource "ibm_is_vpc" "vpc" {
        id                          = "..."
        name                        = "..."
      ~ tags                        = [
          + "cost-center:cloud-engineering",
          + "environment:dev",
          + "team:cloud",
        ]
        # (24 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }
...

Steps to Reproduce

  1. terraform plan

Important Factoids

Running apply does nothing, the tags are drifting to be added on the next plan

Workaround is to remove out tags:

tags = []

It worked on 1.63 and below.

@github-actions github-actions bot added the service/VPC Infrastructure Issues related to the VPC Infrastructure label Apr 3, 2024
@hkantare
Copy link
Collaborator

hkantare commented Apr 3, 2024

@ujjwal-ibm Can you check on this

@ujjwal-ibm
Copy link
Contributor

looking at it

@ujjwal-ibm
Copy link
Contributor

@lra

I ran the below configuration

variable "environment" {
  default = "test"
}
variable "zone_names" {
  default = ["us-south-1"]
}
locals {
  tags = [
    "environment:${var.environment}",
    "team:cloud",
    "cost-center:cloud-engineering",
  ]
  stack_name = "test"
}

resource "ibm_is_vpc" "vpc" {
  name                        = "${local.stack_name}-vpc"
  address_prefix_management   = "manual"
  default_network_acl_name    = "${local.stack_name}-default-acl"
  default_routing_table_name  = "${local.stack_name}-default-routing-table"
  default_security_group_name = "${local.stack_name}-default-sg"
  tags                        = local.tags
}

resource "ibm_is_floating_ip" "fip" {
  for_each       = toset(var.zone_names)
  name           = "${local.stack_name}-gateway-ip-${each.key}"
  zone           = each.key
  tags           = local.tags
}

resource "ibm_is_public_gateway" "gateway" {
  for_each       = toset(var.zone_names)
  name           = "${local.stack_name}-gateway-${each.key}"
  vpc            = ibm_is_vpc.vpc.id
  zone           = each.key
  floating_ip = {
    id = ibm_is_floating_ip.fip[each.key].id
  }
  tags = local.tags
}

Its working as expected

Screenshot 2024-04-03 at 8 21 11鈥疨M

@ujjwal-ibm
Copy link
Contributor

image image image

@ujjwal-ibm
Copy link
Contributor

@lra
can you turn on the trace logs using export TF_LOG=TRACE and share us the logs.

@lra
Copy link
Author

lra commented Apr 3, 2024

It does not look like it's a terraform problem, with new resources I can tag and untag them with terraform.
Looks like a bunch of our existing resources lost their tags and cannot be tagged anymore.

I guess I'll open a ticket with support as it's a problem with the IBM tags service itself.

@lra lra closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
@lra
Copy link
Author

lra commented Apr 3, 2024

If you are interested, I opened a case: CS3880346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants