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

feat(loadbalancing): add hsts option to http frontend #365

Merged
merged 1 commit into from
Feb 8, 2023
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
8 changes: 8 additions & 0 deletions ovh/resource_iploadbalancing_http_frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ func resourceIpLoadbalancingHttpFrontend() *schema.Resource {
Default: false,
Optional: true,
},
"hsts": {
Type: schema.TypeBool,
Default: false,
Optional: true,
},
"redirect_location": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -127,6 +132,7 @@ func resourceIpLoadbalancingHttpFrontendCreate(d *schema.ResourceData, meta inte
DedicatedIpFo: dedicatedIpFo,
Disabled: d.Get("disabled").(bool),
Ssl: d.Get("ssl").(bool),
Hsts: d.Get("hsts").(bool),
RedirectLocation: d.Get("redirect_location").(string),
DisplayName: d.Get("display_name").(string),
HttpHeader: httpHeader,
Expand Down Expand Up @@ -178,6 +184,7 @@ func resourceIpLoadbalancingHttpFrontendRead(d *schema.ResourceData, meta interf
d.Set("display_name", r.DisplayName)
d.Set("port", r.Port)
d.Set("ssl", r.Ssl)
d.Set("hsts", r.Hsts)
d.Set("zone", r.Zone)
d.Set("redirect_location", r.RedirectLocation)
d.Set("http_header", httpHeader)
Expand Down Expand Up @@ -213,6 +220,7 @@ func resourceIpLoadbalancingHttpFrontendUpdate(d *schema.ResourceData, meta inte
DedicatedIpFo: dedicatedIpFo,
Disabled: d.Get("disabled").(bool),
Ssl: d.Get("ssl").(bool),
Hsts: d.Get("hsts").(bool),
RedirectLocation: d.Get("redirect_location").(string),
DisplayName: d.Get("display_name").(string),
HttpHeader: httpHeader,
Expand Down
7 changes: 7 additions & 0 deletions ovh/resource_iploadbalancing_http_frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func TestAccIpLoadbalancingHttpFrontend_basic(t *testing.T) {
"ovh_iploadbalancing_http_frontend.testfrontend", "display_name", test_prefix),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "ssl", "true"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "hsts", "true"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "port", "22280"),
resource.TestCheckResourceAttr(
Expand All @@ -95,6 +97,8 @@ func TestAccIpLoadbalancingHttpFrontend_basic(t *testing.T) {
"ovh_iploadbalancing_http_frontend.testfrontend", "display_name", test_prefix),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "ssl", "false"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "hsts", "false"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "port", "22280,22443"),
resource.TestCheckResourceAttr(
Expand All @@ -110,6 +114,8 @@ func TestAccIpLoadbalancingHttpFrontend_basic(t *testing.T) {
"ovh_iploadbalancing_http_frontend.testfrontend", "display_name", test_prefix),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "ssl", "true"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "hsts", "true"),
resource.TestCheckResourceAttr(
"ovh_iploadbalancing_http_frontend.testfrontend", "port", "22280"),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -150,6 +156,7 @@ resource "ovh_iploadbalancing_http_frontend" "testfrontend" {
port = "22280"
disabled = true
ssl = true
hsts = true
}
`
const testAccCheckOvhIpLoadbalancingHttpFrontendConfig_update = `
Expand Down
1 change: 1 addition & 0 deletions ovh/types_iploadbalancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ type IpLoadbalancingHttpFrontend struct {
DefaultSslId *int `json:"defaultSslId,omitempty"`
Disabled bool `json:"disabled"`
Ssl bool `json:"ssl"`
Hsts bool `json:"hsts"`
RedirectLocation string `json:"redirectLocation,omitempty"`
DisplayName string `json:"displayName,omitempty"`
HttpHeader []string `json:"httpHeader"`
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/iploadbalancing_http_frontend.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ The following arguments are supported:
* `default_ssl_id` - Default ssl served to your customer
* `disabled` - Disable your frontend. Default: 'false'
* `ssl` - SSL deciphering. Default: 'false'
* `hsts` - HTTP Strict Transport Security. Default: 'false'
* `redirect_location` - Redirection HTTP'
* `http_header` - HTTP headers to add to the frontend. List of string.

Expand All @@ -94,3 +95,4 @@ The following attributes are exported:
* `default_ssl_id` - See Argument Reference above.
* `disabled` - See Argument Reference above.
* `ssl` - See Argument Reference above.
* `hsts` - See Argument Reference above.