Skip to content

Conversation

@simonha9
Copy link

@simonha9 simonha9 commented Dec 3, 2025

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

We want the below.

On creation:

  • users cannot set read_replication mode, and we don't want terraform to implicitly sends null since our API will complain

On update:

  • if we are enabling it (disabled -> auto) then the user should set this in configuration
  • if they remove it from config, we can assume (?) they want to disable and we disable it for them (they can also send mode: disabled themselves, maybe we should err out and tell them to do that explicitly)
  • If it is currently not set, and they don't include it in the resource, we omit it entirely and assume the read_replication mode is unchanged

Acceptance test run results

  • I have added or updated acceptance tests for my changes
  • I have run acceptance tests for my changes and included the results below

Steps to run acceptance tests

  • Added a test to verify the user cannot send read_replication on creation and that terraform does not send null implicitly so that the API doesn't complain
  • Added a test to verify that read_replication can be updated if provided on update only. If it is not provided then we assume it is unchanged.

Test output

TF_ACC=1 CLOUDFLARE_API_TOKEN=<account_token> CLOUDFLARE_ACCOUNT_ID=<account_id> go test -v ./internal/services/d1_database -run TestAccCloudflareD1Database_ReadReplicationRejected -timeout 30m
=== RUN   TestAccCloudflareD1Database_ReadReplicationRejected
=== PAUSE TestAccCloudflareD1Database_ReadReplicationRejected
=== CONT  TestAccCloudflareD1Database_ReadReplicationRejected
--- PASS: TestAccCloudflareD1Database_ReadReplicationRejected (0.59s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/services/d1_database	2.286s

TF_ACC=1 CLOUDFLARE_API_TOKEN=<account_token> CLOUDFLARE_ACCOUNT_ID=<account_id> go test -v ./internal/services/d1_database -run TestAccCloudflareD1Database_Basic -timeout 30m
=== RUN   TestAccCloudflareD1Database_Basic
=== PAUSE TestAccCloudflareD1Database_Basic
=== CONT  TestAccCloudflareD1Database_Basic
--- PASS: TestAccCloudflareD1Database_Basic (4.67s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/services/d1_database	6.038s

TTF_ACC=1 CLOUDFLARE_API_TOKEN=<account_token> CLOUDFLARE_ACCOUNT_ID=<account_id> go test -v ./internal/services/d1_database -run TestAccCloudflareD1Database_ReadReplicationUpdate -timeout 30m
=== RUN   TestAccCloudflareD1Database_ReadReplicationUpdate
=== PAUSE TestAccCloudflareD1Database_ReadReplicationUpdate
=== CONT  TestAccCloudflareD1Database_ReadReplicationUpdate
--- PASS: TestAccCloudflareD1Database_ReadReplicationUpdate (8.01s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/services/d1_database	9.567s

Additional context & links

https://jira.cfdata.org/browse/CFSQL-1391

@simonha9 simonha9 changed the title CFSQL-1391 Default read_replication mode to disabled if not provided … DRAFT: CFSQL-1391 Default read_replication mode to disabled if not provided … Dec 3, 2025
@simonha9 simonha9 force-pushed the sha/update-d1-read-replication-mode branch 5 times, most recently from 698b90c to 2234723 Compare December 3, 2025 21:00
@simonha9 simonha9 changed the title DRAFT: CFSQL-1391 Default read_replication mode to disabled if not provided … CFSQL-1391 Do not send read_replication on d1 creation Dec 3, 2025
@simonha9 simonha9 force-pushed the sha/update-d1-read-replication-mode branch from 2234723 to 5b85273 Compare December 3, 2025 21:32
@simonha9 simonha9 changed the title CFSQL-1391 Do not send read_replication on d1 creation CFSQL-1391 Only allow read_replication modification on update Dec 3, 2025
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