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

Bump github.com/cloudflare/cloudflare-go from 0.18.0 to 0.19.0 #1131

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
39 changes: 21 additions & 18 deletions cloudflare/resource_cloudflare_custom_hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func resourceCloudflareCustomHostname() *schema.Resource {
},
"ssl": {
Type: schema.TypeList,
Required: true,
Optional: true,
Elem: &schema.Resource{
SchemaVersion: 1,
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -177,21 +177,21 @@ func resourceCloudflareCustomHostnameRead(d *schema.ResourceData, meta interface

d.Set("hostname", customHostname.Hostname)
d.Set("ssl.custom_origin_server", customHostname.CustomOriginServer)
if customHostname.SSL != nil {
d.Set("ssl.0.type", customHostname.SSL.Type)
d.Set("ssl.0.method", customHostname.SSL.Method)
d.Set("ssl.0.wildcard", customHostname.SSL.Wildcard)
d.Set("ssl.0.status", customHostname.SSL.Status)
d.Set("ssl.0.cname_target", customHostname.SSL.CnameTarget)
d.Set("ssl.0.cname_name", customHostname.SSL.CnameName)
d.Set("ssl.0.custom_certificate", customHostname.SSL.CustomCertificate)
d.Set("ssl.0.custom_key", customHostname.SSL.CustomKey)

d.Set("ssl.0.type", customHostname.SSL.Type)
d.Set("ssl.0.method", customHostname.SSL.Method)
d.Set("ssl.0.wildcard", customHostname.SSL.Wildcard)
d.Set("ssl.0.status", customHostname.SSL.Status)
d.Set("ssl.0.cname_target", customHostname.SSL.CnameTarget)
d.Set("ssl.0.cname_name", customHostname.SSL.CnameName)
d.Set("ssl.0.custom_certificate", customHostname.SSL.CustomCertificate)
d.Set("ssl.0.custom_key", customHostname.SSL.CustomKey)

d.Set("ssl.0.settings.0.http2", customHostname.SSL.Settings.HTTP2)
d.Set("ssl.0.settings.0.tls13", customHostname.SSL.Settings.TLS13)
d.Set("ssl.0.settings.0.min_tls_version", customHostname.SSL.Settings.MinTLSVersion)
d.Set("ssl.0.settings.0.ciphers", flattenStringList(customHostname.SSL.Settings.Ciphers))

d.Set("ssl.0.settings.0.http2", customHostname.SSL.Settings.HTTP2)
d.Set("ssl.0.settings.0.tls13", customHostname.SSL.Settings.TLS13)
d.Set("ssl.0.settings.0.min_tls_version", customHostname.SSL.Settings.MinTLSVersion)
d.Set("ssl.0.settings.0.ciphers", flattenStringList(customHostname.SSL.Settings.Ciphers))
}
ownershipVerificationCfg := map[string]interface{}{}
ownershipVerificationCfg["type"] = customHostname.OwnershipVerification.Type
ownershipVerificationCfg["value"] = customHostname.OwnershipVerification.Value
Expand Down Expand Up @@ -269,10 +269,12 @@ func resourceCloudflareCustomHostnameImport(d *schema.ResourceData, meta interfa
// buildCustomHostname takes the existing schema and returns a
// `cloudflare.CustomHostname`.
func buildCustomHostname(d *schema.ResourceData) cloudflare.CustomHostname {
return cloudflare.CustomHostname{
ch := cloudflare.CustomHostname{
Hostname: d.Get("hostname").(string),
CustomOriginServer: d.Get("custom_origin_server").(string),
SSL: cloudflare.CustomHostnameSSL{
}
if _, ok := d.GetOk("ssl"); ok {
ch.SSL = &cloudflare.CustomHostnameSSL{
Method: d.Get("ssl.0.method").(string),
Type: d.Get("ssl.0.type").(string),
Wildcard: &[]bool{d.Get("ssl.0.wildcard").(bool)}[0],
Expand All @@ -286,6 +288,7 @@ func buildCustomHostname(d *schema.ResourceData) cloudflare.CustomHostname {
MinTLSVersion: d.Get("ssl.0.settings.0.min_tls_version").(string),
Ciphers: expandInterfaceToStringList(d.Get("ssl.0.settings.0.ciphers").([]interface{})),
},
},
}
}
return ch
}
30 changes: 30 additions & 0 deletions cloudflare/resource_cloudflare_custom_hostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,36 @@ resource "cloudflare_custom_hostname" "%[2]s" {
`, zoneID, rnd, domain)
}

func testAccCheckCloudflareCustomHostnameWithNoSSL(zoneID, rnd, domain string) string {
return fmt.Sprintf(`
resource "cloudflare_custom_hostname" "%[2]s" {
zone_id = "%[1]s"
hostname = "%[2]s.%[3]s"
}
`, zoneID, rnd, domain)
}
func TestAccCloudflareCustomHostnameWithNoSSL(t *testing.T) {
t.Parallel()
zoneID := os.Getenv("CLOUDFLARE_ZONE_ID")
domain := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := generateRandomResourceName()
resourceName := "cloudflare_custom_hostname." + rnd
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCheckCloudflareCustomHostnameWithNoSSL(zoneID, rnd, domain),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "zone_id", zoneID),
resource.TestCheckResourceAttr(resourceName, "hostname", fmt.Sprintf("%s.%s", rnd, domain)),
resource.TestCheckNoResourceAttr(resourceName, "ssl"),
),
},
},
})
}

func TestAccCloudflareCustomHostname_UpdatingZoneForcesNewResource(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cloudflare/terraform-provider-cloudflare
go 1.15

require (
github.com/cloudflare/cloudflare-go v0.18.0
github.com/cloudflare/cloudflare-go v0.19.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/terraform-plugin-sdk v1.17.2
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cloudflare-go v0.18.0 h1:9q1yV4XuYqAZKsMUygRFH1rmmDq5rpaVXL+WWfeliao=
github.com/cloudflare/cloudflare-go v0.18.0/go.mod h1:sPWL/lIC6biLEdyGZwBQ1rGQKF1FhM7N60fuNiFdYTI=
github.com/cloudflare/cloudflare-go v0.19.0 h1:GXNEtlgl7gakuybTwxoD8tFrGFvZfghLfXZmitM/8DE=
github.com/cloudflare/cloudflare-go v0.19.0/go.mod h1:sPWL/lIC6biLEdyGZwBQ1rGQKF1FhM7N60fuNiFdYTI=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down