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

Add R2 scopes for api_token_permission_groups #2687

Merged
merged 9 commits into from
Aug 23, 2023

Conversation

Cyb3r-Jak3
Copy link
Contributor

@Cyb3r-Jak3 Cyb3r-Jak3 commented Aug 16, 2023

Adds support for new R2 permission scopes. Also converts to the plugin framework
Closes #2684

@github-actions
Copy link
Contributor

changelog detected ✅

@Cyb3r-Jak3
Copy link
Contributor Author

Marking as draft because I'm getting a weird issue of import cycle with

root@de78b1a86397:/workspaces/terraform-provider-cloudflare# TF_ACC=1 go test ./internal/framework/service/api_token_permissions_groups -v -count 1 -run ^TestAccCloudflareApiTokenPermissio
nGroups_Basic -timeout 120m -parallel 1
# github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/api_token_permissions_groups
package github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/api_token_permissions_groups
        imports github.com/cloudflare/terraform-provider-cloudflare/internal/framework/provider
        imports github.com/cloudflare/terraform-provider-cloudflare/internal/acctest: import cycle not allowed in test
FAIL    github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/api_token_permissions_groups [setup failed]

Not entirely sure why that is because the rulesets resource_test has the same imports

@Cyb3r-Jak3 Cyb3r-Jak3 marked this pull request as draft August 16, 2023 02:55
@jacobbednarz
Copy link
Member

this is a great initiative but i'm also happy if you just do this in the SDKv2 instead. we don't need to solve all of this at once :)

Comment on lines +105 to +117
func stringListChecksum(s []string) string {
sort.Strings(s)
return stringChecksum(strings.Join(s, ""))
}

// stringChecksum takes a string and returns the checksum of the string.
func stringChecksum(s string) string {
h := md5.New()
h.Write([]byte(s))
bs := h.Sum(nil)

return fmt.Sprintf("%x", bs)
}
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 should probably be moved somewhere else, but not sure where the best place would be.

@Cyb3r-Jak3 Cyb3r-Jak3 marked this pull request as ready for review August 16, 2023 22:07
@Cyb3r-Jak3
Copy link
Contributor Author

I've removed the docs changes that aren't related to this change to prevent merge issues.

@jacobbednarz
Copy link
Member

acceptance tests all passing

TF_ACC=1 go test ./internal/framework/service/api_token_permissions_groups -v -run "^TestAccCloudflareApiTokenPermissionGroups_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareApiTokenPermissionGroups_Basic
=== PAUSE TestAccCloudflareApiTokenPermissionGroups_Basic
=== CONT  TestAccCloudflareApiTokenPermissionGroups_Basic
--- PASS: TestAccCloudflareApiTokenPermissionGroups_Basic (13.68s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/api_token_permissions_groups	14.582s

@jacobbednarz jacobbednarz merged commit 52a57b0 into cloudflare:master Aug 23, 2023
@github-actions github-actions bot added this to the v4.13.0 milestone Aug 23, 2023
github-actions bot pushed a commit that referenced this pull request Aug 23, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v4.13.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
@Cyb3r-Jak3 Cyb3r-Jak3 deleted the r2-api-token-scope branch September 7, 2023 21:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support R2 scope for token permissions in api_token_permission_groups datasource
2 participants