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

DLP-1714: added ContextAwareness support for DLP Profiles #3158

Merged
merged 1 commit into from Mar 15, 2024

Conversation

Copy link
Contributor

github-actions bot commented Mar 4, 2024

changelog detected ✅

@jacobbednarz
Copy link
Member

looks like the acceptance test suite is failing

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareDLPProfile_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareDLPProfile_Custom
    resource_cloudflare_dlp_profile_test.go:18: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # cloudflare_dlp_profile.wfvcnogdui will be updated in-place
          ~ resource "cloudflare_dlp_profile" "wfvcnogdui" {
                id                  = "86c1c2d0-0012-41e8-a3e1-f75ef56128d7"
                name                = "wfvcnogdui"
                # (4 unchanged attributes hidden)
        
              - context_awareness {
                  - enabled = false -> null
        
                  - skip {
                      - files = false -> null
                    }
                }
        
                # (1 unchanged block hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccCloudflareDLPProfile_Custom (9.36s)
=== RUN   TestAccCloudflareDLPProfile_Custom_MultipleEntries
    resource_cloudflare_dlp_profile_test.go:46: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # cloudflare_dlp_profile.yvdwhqxfgm will be updated in-place
          ~ resource "cloudflare_dlp_profile" "yvdwhqxfgm" {
                id                  = "27fcbe5e-c9eb-410a-b2a5-6b16f835abc5"
                name                = "yvdwhqxfgm"
                # (4 unchanged attributes hidden)
        
              - context_awareness {
                  - enabled = false -> null
        
                  - skip {
                      - files = false -> null
                    }
                }
        
                # (2 unchanged blocks hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccCloudflareDLPProfile_Custom_MultipleEntries (7.16s)
=== RUN   TestAccCloudflareDLPProfile_CustomWithAllowedMatchCount
    resource_cloudflare_dlp_profile_test.go:86: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # cloudflare_dlp_profile.mqbzpubyck will be updated in-place
          ~ resource "cloudflare_dlp_profile" "mqbzpubyck" {
                id                  = "186c8b97-046b-425b-aeac-0303e437424f"
                name                = "mqbzpubyck"
                # (4 unchanged attributes hidden)
        
              - context_awareness {
                  - enabled = false -> null
        
                  - skip {
                      - files = false -> null
                    }
                }
        
                # (1 unchanged block hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccCloudflareDLPProfile_CustomWithAllowedMatchCount (7.24s)
=== RUN   TestAccCloudflareDLPProfile_ContextAwareness
    resource_cloudflare_dlp_profile_test.go:117: Step 1/1 error: Check failed: Check 10/11 error: cloudflare_dlp_profile.cyhbgrmngo: Attribute 'context_awareness.enabled' not found
--- FAIL: TestAccCloudflareDLPProfile_ContextAwareness (5.65s)
FAIL
FAIL	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	30.263s
FAIL
make: *** [testacc] Error 1

at first glance, i would say it's because you're adding new blocks but not ever setting the values for when they are not explicitly enabled. perhaps you want Computed/Optional or to always set the values?

@MattDavis00
Copy link
Contributor Author

Thank you for the guidance and test output. It helped me debug the provider with the acceptance tests in a proper way compared to what I was originally doing. Turns out I needed Computed in addition to the Optional I already had. Which makes sense as we do compute a value if you don't provide one; I didn't realise you could enable both. The acceptance tests should be green now :)

@jacobbednarz
Copy link
Member

nice one, looks good here too!

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareDLPProfile_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareDLPProfile_Custom
--- PASS: TestAccCloudflareDLPProfile_Custom (9.05s)
=== RUN   TestAccCloudflareDLPProfile_Custom_MultipleEntries
--- PASS: TestAccCloudflareDLPProfile_Custom_MultipleEntries (8.25s)
=== RUN   TestAccCloudflareDLPProfile_CustomWithAllowedMatchCount
--- PASS: TestAccCloudflareDLPProfile_CustomWithAllowedMatchCount (7.65s)
=== RUN   TestAccCloudflareDLPProfile_ContextAwareness
--- PASS: TestAccCloudflareDLPProfile_ContextAwareness (7.94s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	33.718s

@jacobbednarz jacobbednarz merged commit e357155 into cloudflare:master Mar 15, 2024
9 checks passed
@github-actions github-actions bot added this to the v4.27.0 milestone Mar 15, 2024
github-actions bot pushed a commit that referenced this pull request Mar 15, 2024
Copy link
Contributor

This functionality has been released in v4.27.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 Mar 20, 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.

None yet

2 participants