Skip to content

ibm_cr_namespace can return before namespace is fully ready #6614

@shemau

Description

@shemau

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

Affected Resource(s)

  • ibm_cr_namespace

Terraform Configuration Files

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

resource "ibm_cr_namespace" "cr_namespace" {
  count             = var.existing_namespace_name != null ? 0 : 1
  name              = var.namespace_name
  resource_group_id = var.resource_group_id
  tags              = var.tags
}

resource "ibm_resource_tag" "resource_tag" {
  count       = var.existing_namespace_name != null || length(var.tags) == 0 ? 0 : 1
  resource_id = ibm_cr_namespace.cr_namespace[0].crn
  tags        = var.tags
  tag_type    = "user"
}

Debug Output

Panic Output

Expected Behavior

The expected behaviour is to create the tags on the namespace on both first and second runs.

Actual Behavior

The first apply works as expected.
Following a destroy and second apply the ibm_resource_tags fails with

Terraform apply |   with ibm_resource_tag.resource_tag[0],
Terraform apply |   on .terraform/modules/namespaces/main.tf line 20, in resource "ibm_resource_tag" "resource_tag":
Terraform apply |   20: resource "ibm_resource_tag" "resource_tag" {

Steps to Reproduce

  1. terraform apply
  2. terraform destroy
  3. terraform apply

Important Factoids

Slack discussion reports:

the problem was that the resource crn:v1:bluemix:public:container-registry:xx-xx:a/<account id>::namespace:tst01 was in deleted state when the customer tried to set a tag.

References

  • #0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions