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-2386: Adds support for missing team rules settings #1402

Merged

Conversation

jgpaiva
Copy link
Contributor

@jgpaiva jgpaiva commented Jan 21, 2022

This PR adds support for creating rules with session management
settings (check_session), adding HTTP headers (add_headers), and other
missing browser isolation options.

This PR depends on cloudflare/cloudflare-go#786

This PR adds support for creating rules with session management
settings (check_session), adding HTTP headers (add_headers), and other
missing browser isolation options.
@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.

@@ -44,6 +44,8 @@ func TestAccCloudflareTeamsRuleBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "traffic", "any(dns.domains[*] == \"example.com\")"),
resource.TestCheckResourceAttr(name, "rule_settings.0.block_page_enabled", "false"),
resource.TestCheckResourceAttr(name, "rule_settings.0.block_page_reason", "cuz"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.enforce", "true"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.duration", "200s"),
Copy link
Member

Choose a reason for hiding this comment

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

something is up here; the acceptance tests aren't passing

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTeamsRule" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTeamsRuleBasic
    resource_cloudflare_teams_rules_test.go:28: Step 1/1 error: Error running apply: exit status 1

        Error: error creating Teams rule for account "f037e56e89293a057740de681ac9abbe": HTTP status 400: EOF

          with cloudflare_teams_rule.qgngjyuhan,
          on terraform_plugin_test.tf line 2, in resource "cloudflare_teams_rule" "qgngjyuhan":
           2: resource "cloudflare_teams_rule" "qgngjyuhan" {

--- FAIL: TestAccCloudflareTeamsRuleBasic (8.24s)
FAIL
FAIL	github.com/cloudflare/terraform-provider-cloudflare/cloudflare	8.818s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]
FAIL
make: *** [testacc] Error 1

Comment on lines 47 to 48
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.enforce", "true"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.duration", "200s"),
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
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.enforce", "true"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.duration", "200s"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.0.enforce", "true"),
resource.TestCheckResourceAttr(name, "rule_settings.0.check_session.0.duration", "200s"),

@jacobbednarz
Copy link
Member

acceptance tests look good!

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTeamsRuleBasic" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTeamsRuleBasic
--- PASS: TestAccCloudflareTeamsRuleBasic (11.09s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/cloudflare	11.401s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]

once we update the website documentation to include the new fields, we can merge this.

.changelog/1402.txt Outdated Show resolved Hide resolved
@jacobbednarz
Copy link
Member

acceptance tests are now passing

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTeamsRuleBasic" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTeamsRuleBasic
--- PASS: TestAccCloudflareTeamsRuleBasic (13.53s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/cloudflare	14.127s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]

@jacobbednarz jacobbednarz merged commit 9b63c6f into cloudflare:master Jan 28, 2022
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