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

resource/cloudflare_ruleset: add support for transform rules #1169

Merged
merged 32 commits into from
Sep 10, 2021

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Aug 27, 2021

Adds support for URI and HTTP header transformation rules.

Depends on cloudflare/cloudflare-go#699

Closes #1036

@jacobbednarz jacobbednarz force-pushed the add-uri-transformation-support branch from 084458c to df8918b Compare August 27, 2021 05:43
@jacobbednarz jacobbednarz force-pushed the add-uri-transformation-support branch from df8918b to c61b3fc Compare August 27, 2021 05:45
@jacobbednarz jacobbednarz changed the title ruleset: add support for URI header transformations ruleset: add support for transform rules Aug 27, 2021
@jacobbednarz
Copy link
Member Author

integration is good (with the pending cloudflare/cloudflare-go fix patched in)

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareRuleset_" -count 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareRuleset_WAFBasic
=== PAUSE TestAccCloudflareRuleset_WAFBasic
=== RUN   TestAccCloudflareRuleset_WAFManagedRuleset
=== PAUSE TestAccCloudflareRuleset_WAFManagedRuleset
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetOWASP
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetOWASP
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetOWASPBlockXSSWithAnomalyOver60
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetOWASPBlockXSSWithAnomalyOver60
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetOWASPOnlyPL1
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetOWASPOnlyPL1
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetDeployMultiple
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetDeployMultiple
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithSkip
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithSkip
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithTopSkipAndLastSkip
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithTopSkipAndLastSkip
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetWithCategoryBasedOverrides
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetWithCategoryBasedOverrides
=== RUN   TestAccCloudflareRuleset_WAFManagedRulesetWithIDBasedOverrides
=== PAUSE TestAccCloudflareRuleset_WAFManagedRulesetWithIDBasedOverrides
=== RUN   TestAccCloudflareRuleset_MagicTransitUpdateWithHigherPriority
    provider_test.go:138: Skipping acceptance test as 0da42c8d2132a9ddaf714f9e7c920711 is not configured for Magic Transit
--- SKIP: TestAccCloudflareRuleset_MagicTransitUpdateWithHigherPriority (0.00s)
=== RUN   TestAccCloudflareRuleset_TransformationRuleURIPath
=== PAUSE TestAccCloudflareRuleset_TransformationRuleURIPath
=== RUN   TestAccCloudflareRuleset_TransformationRuleURIQuery
=== PAUSE TestAccCloudflareRuleset_TransformationRuleURIQuery
=== RUN   TestAccCloudflareRuleset_TransformationRuleHeaders
=== PAUSE TestAccCloudflareRuleset_TransformationRuleHeaders
=== CONT  TestAccCloudflareRuleset_WAFBasic
--- PASS: TestAccCloudflareRuleset_WAFBasic (2.71s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithTopSkipAndLastSkip
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithTopSkipAndLastSkip (6.13s)
=== CONT  TestAccCloudflareRuleset_TransformationRuleHeaders
--- PASS: TestAccCloudflareRuleset_TransformationRuleHeaders (3.00s)
=== CONT  TestAccCloudflareRuleset_TransformationRuleURIQuery
--- PASS: TestAccCloudflareRuleset_TransformationRuleURIQuery (2.43s)
=== CONT  TestAccCloudflareRuleset_TransformationRuleURIPath
--- PASS: TestAccCloudflareRuleset_TransformationRuleURIPath (2.87s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetWithIDBasedOverrides
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetWithIDBasedOverrides (4.50s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetWithCategoryBasedOverrides
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetWithCategoryBasedOverrides (4.20s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetOWASPOnlyPL1
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetOWASPOnlyPL1 (3.79s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithSkip
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetDeployMultipleWithSkip (6.48s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetDeployMultiple
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetDeployMultiple (5.70s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetOWASPBlockXSSWithAnomalyOver60
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetOWASPBlockXSSWithAnomalyOver60 (4.87s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRuleset
--- PASS: TestAccCloudflareRuleset_WAFManagedRuleset (3.36s)
=== CONT  TestAccCloudflareRuleset_WAFManagedRulesetOWASP
--- PASS: TestAccCloudflareRuleset_WAFManagedRulesetOWASP (3.34s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/cloudflare	54.283s
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]

@jacobbednarz
Copy link
Member Author

cc @pedrosousa if you'd like to wordsmith this one for me too please 😃

website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
website/docs/r/ruleset.html.markdown Outdated Show resolved Hide resolved
@pedrosousa
Copy link
Contributor

cc @pedrosousa if you'd like to wordsmith this one for me too please 😃

Left a few comments!

I'd like to add a few related links pointing to Dev Docs, so that folks can refer to the Ruleset Engine docs and to a few more API examples. Since I can't comment on the first lines of the docs file (there are no PR changes there), let me know how I should proceed. I can create another PR targeting this PR, or I can add a new commit with my proposed links.

Co-authored-by: Pedro Sousa <680496+pedrosousa@users.noreply.github.com>
@jacobbednarz
Copy link
Member Author

thanks for the suggstions! you're welcome to push up a commit to this branch. otherwise, a PR targetting this branch as the base is also totally fine.

jacobbednarz and others added 4 commits August 30, 2021 07:55
We don't need to restrict the entrypoint calls to "execute" calls; send it all as one payload.
resource/cloudflare_ruleset: send ERE payload as one
@pedrosousa
Copy link
Contributor

Created the following PR targeting your branch: #1172.

@jacobbednarz
Copy link
Member Author

wicked! once I land cloudflare-go changes, I'll get this released. Thank you!

Michael Borkenstein and others added 10 commits August 31, 2021 11:49
…` for resource delete

Updates the internal methods to handle mapping `zero_rtt` => `0rtt` when
Terraform attempts to delete the managed resource. Originally introduced
at b64c0c2 however was missed from the
`Delete`.

Closes #1157
…ete-for-0rtt

resource/cloudflare_zone_settings_override: remap `zero_rtt` => `0rtt` for resource delete
…pport-teams-rules-accounts

Mike/gate 1848 terraform support teams rules accounts
Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 3.2.0 to 4.
- [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases)
- [Changelog](https://github.com/crazy-max/ghaction-import-gpg/blob/master/CHANGELOG.md)
- [Commits](crazy-max/ghaction-import-gpg@v3.2.0...v4)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-import-gpg
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…azy-max/ghaction-import-gpg-4

Bump crazy-max/ghaction-import-gpg from 3.2.0 to 4
@jacobbednarz jacobbednarz changed the title ruleset: add support for transform rules resource/cloudflare_ruleset: add support for transform rules Sep 7, 2021
jacobbednarz and others added 13 commits September 10, 2021 14:43
While looking into upgrading to Terraform SDK v2, I found that the state file
was throwing some errors when trying to save `rules`. It turns out that SDK v1
was more forgiving with the types when it came to flattening lists however SDK
v2 is much stricter causing the failures. This fixes issue by correctly
building the state struct and flattening out some of the nested structures.
resource/cloudflare_ruleset: fix state handler
Co-authored-by: Pedro Sousa <680496+pedrosousa@users.noreply.github.com>
@jacobbednarz jacobbednarz merged commit 9f0de28 into master Sep 10, 2021
@jacobbednarz jacobbednarz deleted the add-uri-transformation-support branch September 10, 2021 06:01
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.

Add Transform Rule resources
2 participants