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 Leaked Credential Check Rules resource #4676

Merged
merged 11 commits into from
Dec 5, 2024

Conversation

mrusso19
Copy link
Contributor

@mrusso19 mrusso19 commented Nov 28, 2024

This PR creates a new resource for managing the Leaked Credential Check Rules API.

Running Acceptance Test requires both using cloudflare-go unreleased changes and including the changes from the terraform-provider-cloudflare Leaked Credential Check PR. The Leaked Credential Check PR should be first merged into master and then into this PR.

Tests

$ TEST=./internal/framework/service/leaked_credential_check_rules/ TESTARGS='-run "^TestAccCloudflareLeakedCredentialCheckRules_CRUD" -count 1' make testacc
TF_ACC=1 go test ./internal/framework/service/leaked_credential_check_rules/ -v -run "^TestAccCloudflareLeakedCredentialCheckRules_CRUD" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareLeakedCredentialCheckRules_CRUD
--- PASS: TestAccCloudflareLeakedCredentialCheckRules_CRUD (25.53s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/leaked_credential_check_rules    25.544s

Copy link
Contributor

github-actions bot commented Nov 28, 2024

changelog detected ✅

}
zoneID := cloudflare.ZoneIdentifier(plan.ZoneID.ValueString())
// fetch existing rules from API
existing_rules, err := r.client.V1.LeakedCredentialCheckListDetections(ctx, zoneID, cloudflare.LeakedCredentialCheckListDetectionsParams{})
Copy link
Member

Choose a reason for hiding this comment

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

this functionality isn't going to be ported to v5 as it is custom handling of the payloads. is there a reason this cannot be achieved using the schema and remote service?

return
}

func diffRules(desired []LCCRuleValueModel, current []cloudflare.LeakedCredentialCheckDetectionEntry) (toAdd []cloudflare.LeakedCredentialCheckCreateDetectionParams, toRemove []cloudflare.LeakedCredentialCheckDeleteDetectionParams, toKeep []cloudflare.LeakedCredentialCheckDetectionEntry) {
Copy link
Member

Choose a reason for hiding this comment

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

we'd like to avoid needing this is v5. is there a reason why we don't have the API modelled in a way that this is inbuild and uses a PUT/DELETE correctly?

@jacobbednarz jacobbednarz force-pushed the add-new-lcc-rules-resource branch from fd87915 to 8a4727e Compare December 5, 2024 00:24
@jacobbednarz jacobbednarz force-pushed the add-new-lcc-rules-resource branch from 5e4c035 to 526b324 Compare December 5, 2024 00:35
@jacobbednarz jacobbednarz merged commit 4fbd47a into cloudflare:master Dec 5, 2024
2 checks passed
@github-actions github-actions bot added this to the v4.48.0 milestone Dec 5, 2024
Copy link
Contributor

This functionality has been released in v4.48.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 Dec 11, 2024
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.

2 participants