Skip to content

Commit

Permalink
resource/cloudflare_zone_setting_override: add support for ssl_automa…
Browse files Browse the repository at this point in the history
…tic_mode
  • Loading branch information
jacobbednarz committed Oct 29, 2024
1 parent c477150 commit 5017403
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
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",
}

func resourceCloudflareZoneSettingsOverrideCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,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 @@ -377,6 +377,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

0 comments on commit 5017403

Please sign in to comment.