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

implement custom ssl resource #418

Merged
merged 20 commits into from
Aug 5, 2019
Merged

Conversation

jterzis
Copy link
Contributor

@jterzis jterzis commented Jul 17, 2019

Implementation of custom ssl resource in terraform.
See v4 library https://github.com/cloudflare/cloudflare-go/blob/master/ssl.go.

Tested with terraform v0.11.0

Create a file main.tf after building the plugin with make fmt && make build and insert the following:

provider "cloudflare" {
  email = "${var.cloudflare_email}"
  token = "${var.cloudflare_token}"
}

resource "cloudflare_custom_ssl" "ssl" {
  zone_id = "${var.cloudflare_zone_id}"
  custom_ssl_options = "${var.cloudflare_custom_ssl_options}"
  custom_ssl_priority = "${var.cloudflare_custom_ssl_priority}"
}

variable "cloudflare_zone_id" {
  type = "string"
  default = ""
}

variable "cloudflare_custom_ssl_priority" {
  type = "list"
  default = [{
    "id" = ""
    "priority" = 3
  }]
}

variable "cloudflare_custom_ssl_options" {
  type = "map"
  default = {
    "certificate" = ""
    "private_key" = ""
    "bundle_method" = "ubiquitous"
  }
}

Interpolate the desired variables in the file and run terraform init && terraform plan. Then terraform apply to build resource.

@ghost ghost added the size/L label Jul 17, 2019
@jacobbednarz
Copy link
Member

jacobbednarz commented Jul 17, 2019

Thanks for this @jterzis! Appreciate the effort. Few questions from me (other specific notes inline):

},
"bundle_method": {
Type: schema.TypeString,
Computed: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the API has restrictions on what values can be used here, it's helpful to provide validation before the HTTP interactions are made.

Suggested change
Computed: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"ubiquitous", "optimal", "force"}, false),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have bundle_method here as well as nested under custom_ssl_options. Is there a difference for these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one under custom_ssl_options is passed in during creation. The other is returned by the /zones/:zone_id/custom_certificates/:cert_id which the Read method calls. Added it to top level as a convenience since on Read, the custom_ssl_options map is not set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Generally, we've followed what the public API has returned to ensure we had something consistent to map it off. This feels like it will cause some confusion if the value is present in two spots but not matching.

Copy link
Contributor Author

@jterzis jterzis Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've strived to follow the public API however, the return body from the public api for the POST method on this resource differs from the request body passed into POST in fields and nesting of fields. I've tried to account for both by mapping the POST request body field custom_ssl_options as a nested map and then mapping the return body separately where bundle_method is non-nested (see below return body POST zones/:zone_identifier/custom_certificates from public api).

{
  "success": true,
  "errors": [],
  "messages": [],
  "result": {
    "id": "2458ce5a-0c35-4c7f-82c7-8e9487d3ff60",
    "hosts": [
      "example.com"
    ],
    "issuer": "GlobalSign",
    "signature": "SHA256WithRSA",
    "status": "active",
    "bundle_method": "ubiquitous",
    "geo_restrictions": {
      "label": "us"
    },
    "zone_id": "023e105f4ecef8ad9ca31a8372d0c353",
    "uploaded_on": "2014-01-01T05:20:00Z",
    "modified_on": "2014-01-01T05:20:00Z",
    "expires_on": "2016-01-01T05:20:00Z",
    "priority": 1
  }
}

I think I can set the bundle_method on READ within the nested map, custom_ssl_options and then remove bundle_method from the top level in the schema so we don't have it specified in two places as you've pointed out. But then the return body won't match 1-1 with our public api. I don't have a strong preference here and want to go with our convention so let me if you are okay with a missing bundle_method field in top level of return body.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobbednarz Thanks for adding some clarity to the request. cloudflare-go separates the req/resp payloads into 2 different structs for an underlying POST and returns the same response payload on GETS as it does on the POST (https://github.com/cloudflare/cloudflare-go/blob/master/ssl.go#L65-L92) so Im not sure there is much more to do there.

What I am doing in the schema amounts to merging the 2 structs from cloudflare-go (ZoneCustomSSLOptions, ZoneCustomSSL). In fact, there shouldn't be much confusion in the schema as to which bundle_method is needed for CREATING the resource (at time apply or plan) versus which is READ in since the latter is a Computed attribute in the schema. Maybe it would help if you describe the specific case you are trying to mitigate ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it more, I could probably remove the computed bundle_method from the schema since it's not required to be set in READ only on CREATE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would help if you describe the specific case you are trying to mitigate ?

Good idea, let's start with the issue first and work backwards from there 😄 My main concern is that we're duplicating schema fields for the purposes of making the internals happy. That tells me that something isn't encapsulated or structured correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's abstract away from internals and present the struct that makes sense. And please with no Request/Response fields 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I've normalized the schema struct and removed bundle_method from the top level struct which was duplicative as @jacobbednarz indicated.

State: resourceCloudflareCustomSslImport,
},

Schema: map[string]*schema.Schema{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing some fields from the schema, is this intentional? The API shows the following also available:

  • type
  • geo_restrictions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not supported by v4api https://github.com/cloudflare/cloudflare-go/blob/master/ssl.go#L40-L44. Ill cut a PR against that repo and then update this one likely in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇 thanks for getting that updated! PR is at cloudflare/cloudflare-go#327

},
"bundle_method": {
Type: schema.TypeString,
Optional: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the API has restrictions on what values can be used here, it's helpful to provide validation before the HTTP interactions are made.

Suggested change
Optional: true,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"ubiquitous", "optimal", "force"}, false),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning on adding validations as a separate ticket. This one establishes minimal functionality for creating, updating, deleting custom_ssl resource. I can add validation for requisite parameters on POST , PUT encapsulating functions though no problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understandable. If we can, I prefer to have as much validation up front as (even with MVP style PRs) to speed up the feedback loop that users get. For example, our Terraform configuration is across ~40 domains and if we apply changes we can wait up to a couple of minutes for the payload to hit the Cloudflare API only to inform us that we've incorrectly formatted a field or gave it an unexpected value. Compared to schema based validation, we get that almost instantly. It does make the user UX quite a bit nicer and doesn't waste as much time on larger installs 🙂

Copy link
Contributor Author

@jterzis jterzis Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to update this after I added Validation for post fields that take on a set of string values, namely bundle_method, geo_restrictions, type.

}

func resourceCloudflareCustomSslRead(d *schema.ResourceData, meta interface{}) error {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

log.Printf("[DEBUG] Custom SSL priority found in config: %#v", data)
//type mt map[string]interface{}
var mtSlice []cloudflare.ZoneCustomSSLPriority
if dataOk {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal preference here (so take it or leave it 😛) but I'd look to return early here and instead of nesting another level as while it's not too big of a deal now, Go is pretty good at getting gnarly nested if expressions. I.e.

data, dataOk := d.GetOk("custom_ssl_priority")

// ..

if !dataOk {
    // Perhaps a better exception than `nil` but 🤷‍♂ 
    return mtSlice, nil
}

for _, innerData := range data.([]interface{}) { 
    newData := make(map[string]interface{})
    // .. continue on
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be more idiomatic so Ill take your suggestion, thanks!

switch idName := id; idName {
case "id":
newValue := value.(string)
//newData[id] = newValue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//newData[id] = newValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
// map -> json -> struct
json.Unmarshal(zcspJson, &zcsp)
//return mtSlice, fmt.Errorf("FAILURE: %#v %#v", newData, zcsp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't needed, let's get rid of it.

Suggested change
//return mtSlice, fmt.Errorf("FAILURE: %#v %#v", newData, zcsp)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

func expandToZoneCustomSSLPriority(d *schema.ResourceData) ([]cloudflare.ZoneCustomSSLPriority, error) {
data, dataOk := d.GetOk("custom_ssl_priority")
log.Printf("[DEBUG] Custom SSL priority found in config: %#v", data)
//type mt map[string]interface{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//type mt map[string]interface{}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ghost ghost added size/XL and removed size/L labels Jul 23, 2019
// split the id so we can lookup
idAttr := strings.SplitN(d.Id(), "/", 2)

var zoneName string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it at zoneID as we're in the process of deprecating zoneName from this provider due to the non-unique nature of it in Cloudflare.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, updated

func TestAccCloudflareCustomSSL_Basic(t *testing.T) {
t.Parallel()
var customSSL cloudflare.ZoneCustomSSL
domain := os.Getenv("CLOUDFLARE_DOMAIN")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLOUDFLARE_ZONE_ID is preferred to CLOUDFLARE_DOMAIN for the uniqueness of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i was applying the pattern we currently have elsewhere. I agree zone id a unique identifier is preferable esp. since the tests create actual resources and cost $ potentially.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry about that. We've put the deprecation in place as of the next minor release and I'll be swapping everything over internally once that lands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, updated!

t.Parallel()
var customSSL cloudflare.ZoneCustomSSL
zoneID := os.Getenv("CLOUDFLARE_ZONE_ID")
resourceName := fmt.Sprintf("cloudflare_custom_ssl.foossl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the generateRandomResourceName() method here to build a resource name for the entropy to denote this isn't a static resource (only used for testing) and in the future when we swap all resource names to begin with tf-acc, this will be one less place we need to manually update.

Suggested change
resourceName := fmt.Sprintf("cloudflare_custom_ssl.foossl")
rnd := generateRandomResourceName()
resourceName := "cloudflare_custom_ssl." + rnd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require a couple of flow on updates in this test but ends up being quite a bit more flexible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Updated in commit: 8fa7bea

fmt.Printf("Failed to update custom ssl cert: %s", err)
}

resList, reErr := client.ReprioritizeSSL(zoneID, zcsp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghost ghost added the kind/documentation Categorizes issue or PR as related to documentation. label Jul 29, 2019
return fmt.Sprintf(`
resource "cloudflare_custom_ssl" "%[2]s" {
zone_id = "%[1]s"
options = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a failure for the integration tests


------- Stdout: -------
=== RUN   TestAccCloudflareCustomSSL_Basic
=== PAUSE TestAccCloudflareCustomSSL_Basic
=== CONT  TestAccCloudflareCustomSSL_Basic
--- FAIL: TestAccCloudflareCustomSSL_Basic (0.02s)
    testing.go:568: Step 0 error: config is invalid: Unsupported argument: An argument named "options" is not expected here.
FAIL
Suggested change
options = {
custom_ssl_options = {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that this was not picked up by CI. Good catch! I fixed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have two types of CI running here and only one hooked up to GitHub 🙁 The unit tests passed but these were making the integration tests fail which run on a different system.

We're looking to see if we can have them both hooked into GitHub but it's a chat with Hashicorp as they own the repositories.

certificate = "-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISAw9GlDw8l9n12rmHAKjwRYtFMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTA3MTUyMzI1MzZaFw0x\nOTEwMTMyMzI1MzZaMBwxGjAYBgNVBAMTEXRmLnRlc3QuY2ZhcGkubmV0MIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzRS91Cp5T/QmvxB5WoX/BFkf7KPU\noGZM5SpbmU/nKDSG+8H0yNOP2YycxJ1ZlWW6dNsgbBY1Y6XNvBYOUIDklNu56RZT\nGUfUMCQQHlqM04xCb1oZmnwcmqqEy3WxEHQHGNpfARmgD7prDP4XcFsxyLBCBO6U\n7/wbQ1SCP4LOlOi6EgpTYdFIBa8EU6ev0UbaAjXyF411fF4P9KgROonss6SjmSzs\nEro87JV80kMAarTaEenrJMYy+DkS55rEFtAshJ/ov3HvVBzgJl9tiVBxF/+xybM2\nulWR78mIi9byv5WozrdCFKUGx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ccxNiB76bGvZGfx/sAbo4VHaibOlo/mcP1kmAHtycX\nch8Pq/OWIRtrqxgQb8S6PrGzP9dnd+/MgNQwEkpj2OX5woMJc16nT1PDJRGX7mFi\nkLBsC/W6oNjMKhOEYT2rnq/Qjh53f9WDOPtgM73WoTUCgYAnYT8lyRyRVrgm925h\nrzE1uHcK7k6ZgSsIHTy3HLi7GQTzIbAMDmz0ZrTZgyEnrvTSuvHklxreUrBBt1+W\n5HbyCTwlUxkKQcj7QX5IlKe1IpvhSjvplG6bPHvHQWPmnFL4Q0WPRwISWPcoP/Ih\nqHXCFswfipntRh3ghFnACt55xg==\n-----END PRIVATE KEY-----\n"
bundle_method = "ubiquitous",
geo_restrictions = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fixing the issue above, this is now failing with the following error

=== RUN   TestAccCloudflareCustomSSL_Basic
=== PAUSE TestAccCloudflareCustomSSL_Basic
=== CONT  TestAccCloudflareCustomSSL_Basic
--- FAIL: TestAccCloudflareCustomSSL_Basic (0.02s)
    testing.go:568: Step 0 error: config is invalid: Incorrect attribute value type: Inappropriate value for attribute "custom_ssl_options": element "geo_restrictions": string required.
FAIL
FAIL	github.com/terraform-providers/terraform-provider-cloudflare/cloudflare	0.050s

We will need to look at getting these fixed before we merge this in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the value usd is invalid here. The schema only allows "us", "eu", "highest_security"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I (and integration tests) are still seeing failures here. It doesn't look like you've addressed the issue with geo_restrictions yet.

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remainder of the code looks good however the tests are failing. We'll need to sort that out before merge.

John Terzis added 2 commits July 30, 2019 15:47
@snoopdouglas
Copy link

snoopdouglas commented Jul 31, 2019

Are we including origin certificates as part of this PR, or will this need to be a separate resource?

Edit: sorry, origin certificates are a discrete resource (API) - so this won't apply

@patryk patryk merged commit 7b4dece into cloudflare:master Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants