Skip to content

resource_selector on ctrlplane_environment produces perpetual diff due to whitespace normalization #1024

@jsbroks

Description

@jsbroks
Terraform: >= 1.8.0
ctrlplanedev/ctrlplane: ~> 1.11

The resource_selector attribute on ctrlplane_environment produces a diff on every terraform plan/terraform apply, even when no changes have been made. The API appears to normalize the selector string (collapsing multi-line values to a single line or stripping whitespace), but the provider does not normalize the value when reading state back, causing a perpetual mismatch.

resource "ctrlplane_environment" "clusters_eu_prod" {
  name              = "clusters-eu-prod"
  description       = "All EU Prod clusters"
  resource_selector = <<-EOT
    resource.kind == 'KubernetesCluster' &&
    resource.metadata['geo-region'] == 'eu' &&
    resource.metadata['stage'] == 'prod'
  EOT
}

Every terraform plan shows a diff on resource_selector

Metadata

Metadata

Labels

bugSomething isn't workingp3

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions