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

GATE-2448: Adds support for proxy endpoints #1517

Conversation

Michael9127
Copy link
Contributor

No description provided.

@github-actions
Copy link
Contributor

Oops! It looks like no changelog entry is attached to this PR. Please include a release note as described in https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/docs/changelog-process.md.

Example:

```release-note:TYPE
Release note
```

If you do not require a release note to be included, please add the workflow/skip-changelog-entry label.

@Michael9127 Michael9127 force-pushed the mike/GATE-2448-add-proxy-endpoint-support branch from b83b13d to 70f731a Compare March 17, 2022 16:59
CHANGELOG.md Outdated
@@ -3,6 +3,7 @@
FEATURES:

* **New Resource:** `cloudflare_waiting_room_event` ([#1509](https://github.com/cloudflare/terraform-provider-cloudflare/issues/1509))
* **New Resource:** `cloudflare_teams_proxy_endpoint`
Copy link
Member

Choose a reason for hiding this comment

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

this file is automatically generated, check out https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/docs/changelog-process.md to add a changelog entry.

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!

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.

solid start! to get this over the line we need:

cloudflare/resource_cloudflare_teams_proxy_endpoints.go Outdated Show resolved Hide resolved
cloudflare/resource_cloudflare_teams_proxy_endpoints.go Outdated Show resolved Hide resolved
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(name, "account_id", accountID),
resource.TestCheckResourceAttr(name, "name", rnd),
resource.TestCheckResourceAttr(name, "ips.0", "1.2.3.4/32"),
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 IP ranges from RFC5737 for our tests/documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah right, I forget every time. Fixed!

Computed: true,
},
"ips": {
Type: schema.TypeList,
Copy link
Member

Choose a reason for hiding this comment

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

do you care about order? if not, you probably want TypeSet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice, done

@Michael9127 Michael9127 force-pushed the mike/GATE-2448-add-proxy-endpoint-support branch 2 times, most recently from 854cb7c to ca3fb3a Compare March 21, 2022 15:53
@Michael9127 Michael9127 force-pushed the mike/GATE-2448-add-proxy-endpoint-support branch from ca3fb3a to b955125 Compare March 21, 2022 15:59
updatedProxyEndpoint := cloudflare.TeamsProxyEndpoint{
ID: d.Id(),
Name: d.Get("name").(string),
IPs: inflateProxyEndpointIPs(d.Get("ips").([]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
IPs: inflateProxyEndpointIPs(d.Get("ips").([]interface{})),
IPs: expandInterfaceToStringList(d.Get("ips").([]interface{})),

Comment on lines 132 to 138
func inflateProxyEndpointIPs(ips []interface{}) []string {
i := make([]string, len(ips))
for x, ip := range ips {
i[x] = ip.(string)
}
return i
}
Copy link
Member

Choose a reason for hiding this comment

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

duplicates expandInterfaceToStringList

Suggested change
func inflateProxyEndpointIPs(ips []interface{}) []string {
i := make([]string, len(ips))
for x, ip := range ips {
i[x] = ip.(string)
}
return i
}

@jacobbednarz
Copy link
Member

acceptance tests are passing

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTeamsProxyEndpoint_" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTeamsProxyEndpoint_Basic
--- PASS: TestAccCloudflareTeamsProxyEndpoint_Basic (10.54s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/cloudflare	11.092s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/maintainer-only-file-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/tf-log-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]

@jacobbednarz jacobbednarz merged commit df3f6f4 into cloudflare:master Mar 21, 2022
@jacobbednarz
Copy link
Member

thank you @Michael9127 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants