Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/cloudflare_zone_cache_reserve: add a new resource type #2642

Merged

Conversation

kwilczynski
Copy link
Contributor

@kwilczynski kwilczynski commented Jul 31, 2023

Add a new resource that can be used to manage a Cache Reserve feature of a given zone.

While at it, add a new data source to complete the newly added resource so that the current status of the Cache Reserve feature can be read for a given zone.

Closes: #2420

Related to:

More details can be found at:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 31, 2023

changelog detected ✅

@kwilczynski kwilczynski force-pushed the feature/support-cache-reserve branch 3 times, most recently from 1753c28 to 1f0589f Compare July 31, 2023 19:17
@kwilczynski
Copy link
Contributor Author

kwilczynski commented Jul 31, 2023

Unit tests:

$ go test ./... -count 1 -parallel 1 -race
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/internal/acctest	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/internal/consts	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/expanders	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/flatteners	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/modifiers/defaults	[no test files]
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/provider	0.023s [no tests to run]
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/example	0.023s [no tests to run]
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/r2_bucket	0.034s
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/rulesets	0.044s
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/turnstile	0.033s
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	0.390s
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/utils	0.081s

Acceptance tests:

$ TF_ACC=1 go test ./internal/sdkv2provider/ -v -count 1 -run '^TestAcc(.+)?CloudflareZoneCacheReserve' -timeout 120m -parallel 1
=== RUN   TestAccDataCloudflareZoneCacheReserve_Basic
=== PAUSE TestAccDataCloudflareZoneCacheReserve_Basic
=== RUN   TestAccCloudflareZoneCacheReserve_Import
=== PAUSE TestAccCloudflareZoneCacheReserve_Import
=== RUN   TestAccCloudflareZoneCacheReserve_Basic
=== PAUSE TestAccCloudflareZoneCacheReserve_Basic
=== CONT  TestAccDataCloudflareZoneCacheReserve_Basic
--- PASS: TestAccDataCloudflareZoneCacheReserve_Basic (3.00s)
=== CONT  TestAccCloudflareZoneCacheReserve_Basic
--- PASS: TestAccCloudflareZoneCacheReserve_Basic (4.25s)
=== CONT  TestAccCloudflareZoneCacheReserve_Import
--- PASS: TestAccCloudflareZoneCacheReserve_Import (3.11s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	10.360s

return
},
},
"enabled": {
Copy link
Contributor Author

@kwilczynski kwilczynski Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the reviewer:

I made this to be a required attribute on purpose, as this has both a monetary value attached to it and performance side-effects when enabled (or disabled), especially since it requires a dedicated pricing plan to be enabled. As such, the user has to explicitly choose to enable or disable this feature of their zone.

Thus, no default setting is being offered here.

CHANGELOG.md Outdated Show resolved Hide resolved
@kwilczynski
Copy link
Contributor Author

Updated unit and acceptance tests following addressing review feedback: #2642 (comment)

@kwilczynski kwilczynski force-pushed the feature/support-cache-reserve branch 2 times, most recently from fec4eb4 to fb71013 Compare August 1, 2023 09:04
Add a new resource that can be used to manage a Cache Reserve feature of
a given zone.

While at it, add a new data source to complete the newly added resource
so that the current status of the Cache Reserve feature can be read for
a given zone.

Signed-off-by: Krzysztof Wilczyński <[email protected]>
Signed-off-by: Krzysztof Wilczyński <[email protected]>
@kwilczynski kwilczynski force-pushed the feature/support-cache-reserve branch from fb71013 to 57ddc45 Compare August 1, 2023 13:41
@jacobbednarz jacobbednarz merged commit 8412de9 into cloudflare:master Aug 2, 2023
@github-actions github-actions bot added this to the v4.12.0 milestone Aug 2, 2023
@jacobbednarz
Copy link
Member

thanks @kwilczynski, appreciate the effort getting this one over the line 👏 🏆

github-actions bot pushed a commit that referenced this pull request Aug 2, 2023
@kwilczynski kwilczynski deleted the feature/support-cache-reserve branch August 2, 2023 07:04
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

This functionality has been released in v4.12.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Cache Reserve
2 participants