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

Add new rate plans #2023

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2023.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_zone: add new plans for zone subscriptions
```
2 changes: 1 addition & 1 deletion docs/resources/zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "cloudflare_zone" "example" {
- `account_id` (String) Account ID to manage the zone resource in.
- `jump_start` (Boolean) Whether to scan for DNS records on creation. Ignored after zone is created.
- `paused` (Boolean) Whether this zone is paused (traffic bypasses Cloudflare). Defaults to `false`.
- `plan` (String) The name of the commercial plan to apply to the zone. Available values: `free`, `pro`, `business`, `enterprise`, `partners_free`, `partners_pro`, `partners_business`, `partners_enterprise`.
- `plan` (String) The name of the commercial plan to apply to the zone. Available values: `free`, `lite`, `pro`, `pro_plus`, `business`, `enterprise`, `partners_free`, `partners_pro`, `partners_business`, `partners_enterprise`.
- `type` (String) A full zone implies that DNS is hosted with Cloudflare. A partial zone is typically a partner-hosted zone or a CNAME setup. Available values: `full`, `partial`. Defaults to `full`.

### Read-Only
Expand Down
12 changes: 12 additions & 0 deletions internal/provider/resource_cloudflare_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
// we enforce the use of the Cloudflare API 'legacy_id' field until the mapping of plan is fixed in cloudflare-go.
const (
planIDFree = "free"
planIDLite = "lite"
planIDPro = "pro"
planIDProPlus = "pro_plus"
planIDBusiness = "business"
planIDEnterprise = "enterprise"

Expand All @@ -39,11 +41,21 @@ var ratePlans = map[string]subscriptionData{
ID: planIDFree,
Description: "Free Website",
},
planIDLite: {
Name: "CF_LITE",
ID: planIDLite,
Description: "Lite Website",
},
planIDPro: {
Name: "CF_PRO_20_20",
ID: planIDPro,
Description: "Pro Website",
},
planIDProPlus: {
Name: "CF_PRO_PLUS",
ID: planIDProPlus,
Description: "Pro Plus Website",
},
planIDBusiness: {
Name: "CF_BIZ",
ID: planIDBusiness,
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/schema_cloudflare_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ func resourceCloudflareZoneSchema() map[string]*schema.Schema {
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
planIDFree,
planIDLite,
planIDPro,
planIDProPlus,
planIDBusiness,
planIDEnterprise,
planIDPartnerFree,
Expand All @@ -56,7 +58,9 @@ func resourceCloudflareZoneSchema() map[string]*schema.Schema {
}, false),
Description: fmt.Sprintf("The name of the commercial plan to apply to the zone. %s", renderAvailableDocumentationValuesStringSlice([]string{
planIDFree,
planIDLite,
planIDPro,
planIDProPlus,
planIDBusiness,
planIDEnterprise,
planIDPartnerFree,
Expand Down