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 support for Opt-In Split Tunnel Overlapping IPs #2974

Closed
wants to merge 20 commits into from

Conversation

da-cf
Copy link
Contributor

@da-cf da-cf commented Dec 1, 2023

Add two new fields to the device settings policy. This is to add API support for the Opt-In Split Tunnel Overlapping IPs feature:

lan_allow_minutes (uint) used to set the amount of time a user can access a LAN subnet.
lan_allow_subnet_size (uint) the allowed subnet size for the lan

Depends on cloudflare-go PR #1454.

Copy link
Contributor

github-actions bot commented Dec 1, 2023

changelog detected ✅

Copy link
Contributor

Marking this pull request as stale due to 14 days of inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the lifecycle/stale label.
If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

@da-cf
Copy link
Contributor Author

da-cf commented Dec 28, 2023

Work has been de-prioritized, but will be picked back up within the coming weeks.

Copy link
Contributor

Marking this pull request as stale due to 14 days of inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the lifecycle/stale label.
If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

@jacobbednarz
Copy link
Member

acceptance tests all passing

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareDeviceSettingsPolicy_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareDeviceSettingsPolicy_Create
--- PASS: TestAccCloudflareDeviceSettingsPolicy_Create (19.78s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	20.841s

@da-cf looking at your schema, i see some slightly confusing behaviour. lan_allow_minutes is optional however, we are always sending it which will result in "0". is this intentional? i don't think so but wanted to confirm. lan_allow_subnet_size has a default of "24" so we'll always send that too. is that your intention? we probably want to update these test cases to explicitly cover both of these cases as previously, it just wasn't being defined and had a bit of copy pasta from other tests.

@da-cf
Copy link
Contributor Author

da-cf commented Jan 31, 2024

acceptance tests all passing

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareDeviceSettingsPolicy_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareDeviceSettingsPolicy_Create
--- PASS: TestAccCloudflareDeviceSettingsPolicy_Create (19.78s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	20.841s

@da-cf looking at your schema, i see some slightly confusing behaviour. lan_allow_minutes is optional however, we are always sending it which will result in "0". is this intentional? i don't think so but wanted to confirm. lan_allow_subnet_size has a default of "24" so we'll always send that too. is that your intention? we probably want to update these test cases to explicitly cover both of these cases as previously, it just wasn't being defined and had a bit of copy pasta from other tests.

Thanks for catching this. This completely slipped my mind.

Both fields are optional, and should not be returned at all in a JSON response if they are nil. The subnet size also should not have a default value. I've updated the PR to reflect this.

@jacobbednarz
Copy link
Member

looks like we've got some differences in the resource refresh

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareDeviceSettingsPolicy_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareDeviceSettingsPolicy_Create
    resource_cloudflare_device_settings_policy_test.go:31: Step 2/4 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_device_settings_policy.krhnceymym will be updated in-place
          ~ resource "cloudflare_device_settings_policy" "krhnceymym" {
              ~ default               = false -> true
                id                    = "f037e56e89293a057740de681ac9abbe/aa252f0d-aa52-4829-92f0-f135e77bd398"
              - match                 = "identity.email == \"foo@example.com\"" -> null
                name                  = "krhnceymym"
              - precedence            = 10 -> null
                # (16 unchanged attributes hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccCloudflareDeviceSettingsPolicy_Create (14.42s)
FAIL
FAIL	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	14.829s
FAIL
make: *** [testacc] Error 1

Copy link
Contributor

Marking this pull request as stale due to 14 days of inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the lifecycle/stale label.
If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

@da-cf
Copy link
Contributor Author

da-cf commented Mar 4, 2024

Finishing up fixing the tests today. Will add a comment here when I'm ready to merge :)

Copy link
Contributor

Marking this pull request as stale due to 14 days of inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the lifecycle/stale label.
If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!

Copy link
Contributor

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants