Skip to content

Commit

Permalink
Merge pull request #1286 from zaidoon1/zaidoon/add_early_hints_ssl_se…
Browse files Browse the repository at this point in the history
…ttings_schema

add early_hints to ssl settings schema
  • Loading branch information
jacobbednarz authored Oct 31, 2021
2 parents efdac5b + 6d1a5d2 commit b79dbbb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/1286.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_custom_hostname: add `settings.early_hints` to ssl schema
```
7 changes: 7 additions & 0 deletions cloudflare/resource_cloudflare_custom_hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func resourceCloudflareCustomHostname() *schema.Resource {
Type: schema.TypeString,
},
},
"early_hints": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"on", "off"}, false),
},
},
},
},
Expand Down Expand Up @@ -174,6 +179,7 @@ func resourceCloudflareCustomHostnameRead(d *schema.ResourceData, meta interface
"tls13": customHostname.SSL.Settings.TLS13,
"min_tls_version": customHostname.SSL.Settings.MinTLSVersion,
"ciphers": customHostname.SSL.Settings.Ciphers,
"early_hints": customHostname.SSL.Settings.EarlyHints,
}},
})
}
Expand Down Expand Up @@ -284,6 +290,7 @@ func buildCustomHostname(d *schema.ResourceData) cloudflare.CustomHostname {
TLS13: d.Get("ssl.0.settings.0.tls13").(string),
MinTLSVersion: d.Get("ssl.0.settings.0.min_tls_version").(string),
Ciphers: expandInterfaceToStringList(d.Get("ssl.0.settings.0.ciphers").(*schema.Set).List()),
EarlyHints: d.Get("ssl.0.settings.0.early_hints").(string),
},
}
}
Expand Down
4 changes: 4 additions & 0 deletions cloudflare/resource_cloudflare_custom_hostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ resource "cloudflare_custom_hostname" "%[2]s" {
"ECDHE-RSA-AES128-GCM-SHA256",
"AES128-SHA"
]
early_hints = "off"
}
}
}
Expand All @@ -204,6 +205,7 @@ func TestAccCloudflareCustomHostnameUpdate(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.http2", "off"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.min_tls_version", "1.2"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.ciphers.#", "2"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.early_hints", "off"),
),
},
{
Expand All @@ -214,6 +216,7 @@ func TestAccCloudflareCustomHostnameUpdate(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.http2", "off"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.min_tls_version", "1.1"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.ciphers.#", "2"),
resource.TestCheckResourceAttr(resourceName, "ssl.0.settings.0.early_hints", "off"),
),
},
},
Expand All @@ -234,6 +237,7 @@ resource "cloudflare_custom_hostname" "%[2]s" {
"ECDHE-RSA-AES128-GCM-SHA256",
"AES128-SHA"
]
early_hints = "off"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/custom_hostname.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The following arguments are supported:
* `min_tls_version` - (Optional) Lowest version of TLS this certificate should
support. Valid values are `"1.0"`, `"1.1"`, `"1.2"` and `"1.3"`.
* `ciphers` - (Optional) List of SSL/TLS ciphers to associate with this certificate.
* `early_hints` - (Optional) Whether or not early hints should be supported. Valid values are `"on"` or `"off"`.

## Attributes Reference

Expand Down

0 comments on commit b79dbbb

Please sign in to comment.