Skip to content

[BUG] cloudfoundry_org resource rejects empty labels map ({}) #490

Description

@geigerj0

Describe the bug

The provider rejects an empty labels map ({}) with the following error:

│ Error: Invalid Attribute Value
│ 
│   with cloudfoundry_org.my_org,
│   on main.tf line 18, in resource "cloudfoundry_org" "my_org":
│   18:   labels = var.cf_org_labels
│ 
│ Attribute labels map must contain at least 1 elements, got: 0

Expected Behavior

Setting labels = {} (an empty map) on a cloudfoundry_org resource should be valid. An organization may intentionally have no labels provided via a variable. The provider should accept an empty map and either skip label management or remove any existing labels.

Steps To Reproduce

variable "cf_org_labels" {
  type = map(string)
}

resource "cloudfoundry_org" "my_org" {
  name   = "my-org"
  labels = var.cf_org_labels
}
terraform apply -var='cf_org_labels={}'

What version of the Terraform provider are you using?

1.13.0

What version of the Terraform CLI are you using?

1.14.0

What CF API version are you using?

3.216.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions