Skip to content

Fix copy_to_regions optional field causing Value Conversion Error#550

Open
TJM wants to merge 1 commit into
couchbasecloud:mainfrom
TJM:fix/gcp-snapshot
Open

Fix copy_to_regions optional field causing Value Conversion Error#550
TJM wants to merge 1 commit into
couchbasecloud:mainfrom
TJM:fix/gcp-snapshot

Conversation

@TJM

@TJM TJM commented Apr 9, 2026

Copy link
Copy Markdown

Summary

  • copy_to_regions was typed as []types.String in the schema struct but declared as a SetAttribute in the resource schema. When the field is omitted from config, the Terraform framework sets it to an unknown value that a plain Go slice cannot represent — only types.Set can.
  • Changed CopyToRegions field from []types.String to types.Set and updated all conversion logic accordingly.
  • Added an acceptance test covering creation without copy_to_regions set.

Reproduction

resource "couchbase-capella_cloud_snapshot_backup_schedule" "example" {
  interval        = 4
  retention       = 168
  start_time      = "2024-01-01T00:00:00+00:00"
  cluster_id      = couchbase-capella_cluster.example.id
  project_id      = couchbase-capella_cluster.example.project_id
  organization_id = local.capella_org_id
}

Previously produced:

│ Error: Value Conversion Error
│ Path: copy_to_regions
│ Target Type: []basetypes.StringValue
│ Suggested Type: basetypes.SetValue

Test plan

  • TestAccSnapshotBackupScheduleResourceWithoutCopyToRegions — new test, creates resource without copy_to_regions
  • TestAccSnapshotBackupScheduleResource — existing happy-path test still passes
  • TestAccSnapshotBackupScheduleResourceInvalidCopyToRegions — existing negative test still passes

🤖 Generated with Claude Code

CopyToRegions was typed as []types.String in the schema struct, but the
resource schema declares it as a SetAttribute. When the field is omitted
from config, the framework sets it to an unknown value that a plain Go
slice cannot represent — only types.Set can. Changed the field to
types.Set and updated all conversion logic accordingly.

Also adds an acceptance test covering creation without copy_to_regions set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@TJM TJM requested a review from a team as a code owner April 9, 2026 21:33
@TJM

TJM commented Apr 9, 2026

Copy link
Copy Markdown
Author

A workaround for anyone trying to set these up before this MR is merged, you can set copy_to_regions to an empty set:

  copy_to_regions = toset([])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant