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_setting_override: add support for ssl_automatic_mode #4465

Merged
merged 3 commits into from
Jan 6, 2025
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/4465.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_zone_settings_override: add support for `ssl_automatic_mode`
```
4 changes: 3 additions & 1 deletion docs/resources/zone_settings_override.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Optional:
- `sort_query_string_for_cache` (String)
- `speed_brain` (String)
- `ssl` (String)
- `ssl_automatic_mode` (String)
- `tls_1_2_only` (String, Deprecated)
- `tls_1_3` (String)
- `tls_client_auth` (String)
Expand All @@ -144,7 +145,7 @@ Optional:

Optional:

- `enabled` (Boolean) Whether Aegis zone setting is enabled.
- `enabled` (Boolean) Whether Aegis zone setting is enabled. Defaults to `true`.
- `pool_id` (String) Egress pool id which refers to a grouping of dedicated egress IPs through which Cloudflare will connect to origin.


Expand Down Expand Up @@ -244,6 +245,7 @@ Read-Only:
- `sort_query_string_for_cache` (String)
- `speed_brain` (String)
- `ssl` (String)
- `ssl_automatic_mode` (String)
- `tls_1_2_only` (String)
- `tls_1_3` (String)
- `tls_client_auth` (String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var fetchAsSingleSetting = []string{
"nel",
"replace_insecure_js",
"speed_brain",
"ssl_automatic_mode",
"aegis",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,36 @@ resource "cloudflare_zone_settings_override" "%[1]s" {
}`, rnd, zoneID)
}

func TestAccCloudflareZoneSettingsOverride_SSLAutomaticMode(t *testing.T) {
zoneID := os.Getenv("CLOUDFLARE_ZONE_ID")
rnd := generateRandomResourceName()
name := "cloudflare_zone_settings_override." + rnd

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccCheckCloudflareZoneSettingsOverrideSSLAutomaticMode(rnd, zoneID),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudflareZoneSettings(name),
resource.TestCheckResourceAttr(name, "settings.0.ssl_automatic_mode", "auto"),
),
},
},
})
}

func testAccCheckCloudflareZoneSettingsOverrideSSLAutomaticMode(rnd, zoneID string) string {
return fmt.Sprintf(`
resource "cloudflare_zone_settings_override" "%[1]s" {
zone_id = "%[2]s"
settings {
ssl_automatic_mode = "auto"
}
}`, rnd, zoneID)
}

func TestCloudflareZoneSettingsOverrideStateUpgradeV0(t *testing.T) {
v0 := map[string]interface{}{
"settings": []interface{}{map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ var resourceCloudflareZoneSettingsSchema = map[string]*schema.Schema{
ValidateFunc: validation.StringInSlice([]string{"off", "flexible", "full", "strict", "origin_pull"}, false), // depends on plan
},

"ssl_automatic_mode": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"auto", "custom"}, false),
},

"universal_ssl": {
Type: schema.TypeString,
Optional: true,
Expand Down
Loading