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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to destroy multiple defined tags properly #2265

Open
luckeyca opened this issue Jan 10, 2025 · 0 comments
Open

failed to destroy multiple defined tags properly #2265

luckeyca opened this issue Jan 10, 2025 · 0 comments
Labels

Comments

@luckeyca
Copy link

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 "me too" comments, 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 Version and Provider Version

Terraform v1.8.5
on linux_amd64

  • provider registry.terraform.io/hashicorp/time v0.12.1
  • provider registry.terraform.io/oracle/oci v6.21.0

Affected Resource(s)

oci_identity_tag_namespace and oci_identity_tag

Terraform Configuration Files

locals {
  defined_tag_keys = ["k1", "k2", "k3"]


  defined_tag_defaults = [
    {
      key       = "k1"
      namespace = "NS"
      value     = "v1"
    },
    {
      key       = "k2"
      namespace = "NS"
      value     = "v2"
    },
    {
      key       = "k3"
      namespace = "NS"
      value     = "v3"
    }
  ]
}


data "oci_identity_tenancy" "current" {
  tenancy_id = "ocid1.tenancy.oc1..aaaaaaaawxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

resource "oci_identity_tag_namespace" "this" {
  compartment_id = data.oci_identity_tenancy.current.id
  description    = "Test Namespace"
  name           = "NS"
  is_retired     = false
}

resource "oci_identity_tag" "these" {
  for_each         = toset(local.defined_tag_keys)
  description      = "Defined Tag Key Definition in NS Tag Namespace"
  name             = each.key
  tag_namespace_id = oci_identity_tag_namespace.this.id
  is_retired       = false
}

resource "oci_identity_tag_default" "these" {
  for_each          = { for tag in local.defined_tag_defaults: tag.key => tag.value }
  compartment_id    = data.oci_identity_tenancy.current.id
  tag_definition_id = oci_identity_tag.these[each.key].id
  value             = each.value
  is_required       = true
}

Debug Output


│ Error: 429-TooManyRequests, Tenant has been throttled. Too Many Requests
│ Suggestion: Please re-apply your Terraform config and/or increase the retry timeout using this document: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformtroubleshooting.htm#common_issues__automaticretries
│ Documentation: https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/identity_tag
│ API Reference: https://docs.oracle.com/iaas/api/#/en/identity/20160918/Tag/DeleteTag
│ Request Target: DELETE https://identity.ca-toronto-1.oci.oraclecloud.com/20160918/tagNamespaces/ocid1.tagnamespace.oc1..aaaaaaaas4jtlhko64f22bhpzxf4x2strcysub4bczhyroivpc4svpk2u6yq/tags/k3
│ Provider version: 6.21.0, released on 2024-12-22. This provider is 2 Update(s) behind to current.
│ Service: Identity Tag
│ Operation Name: DeleteTag
│ OPC request ID: 7737077f23a440e1cf21a80dffdbc971/92E643E906742C48465D23A5E6BC4CF6/006F3E46D0BFDF07E7C6201FF6A1DCD2

Expected Behavior

When creating multiple tag namespace and/or multiple defined tags, the creation was successfully 100%. So the terraform destroy should work fine as well.

Actual Behavior

If to create multiple tag namespace and/or multiple defined tags using loop, either for or for_each, terraform apply works, but terraform destroy will fail 100% and require multiple re-run to have the destroy done. It's the same behavior using OCI GUI console because on GUI console, it allows multiple selections for tag namespace and defined tags, however, the deletion will fail with the same error message as terraform error.

Steps to Reproduce

  1. filled in the tenancy ocid in the code snippet above
  2. terraform apply -auto-approve
  3. terraform apply -destroy -auto-approve
@luckeyca luckeyca added the bug label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant