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_tunnel_config: fix duration handling #2510

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

jacobbednarz
Copy link
Member

Due to marshal/unmarshal support lacking for time.Duration in Go 1, we were previously sending nanosecond values to the API instead of the required seconds. This would have resulted in higher than usual timeout durations (10 seconds would have been sent as 1000000000 seconds since it duration unmarshals to nanoseconds).

Updates all the instances of time duration handling in cloudflare_tunnel_config resource to use the newly introduced TunnelDuration to ensure we correctly setting the units.

Depends on cloudflare/cloudflare-go#1303
Closes #2495

@jacobbednarz jacobbednarz force-pushed the handle-tunnel-duration-in-paylods branch from 638eb75 to 1937543 Compare June 8, 2023 04:16
@jacobbednarz
Copy link
Member Author

acceptance tests all passing

TF_ACC=1 go test ./internal/sdkv2provider -v -run "^TestAccCloudflareTunnelConfig_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareTunnelConfig_Full
--- PASS: TestAccCloudflareTunnelConfig_Full (25.28s)
=== RUN   TestAccCloudflareTunnelConfig_Short
--- PASS: TestAccCloudflareTunnelConfig_Short (23.35s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/sdkv2provider	49.789s

HTTP payloads have also been manually verified as sending the seconds value.

@jacobbednarz
Copy link
Member Author

cc @obezuk

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

changelog detected ✅

@jacobbednarz jacobbednarz added the workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library. label Jun 8, 2023
@szandala

This comment was marked as spam.

Due to marshal/unmarshal support lacking in Go 1[1], we were previously
sending nanosecond values to the API instead of the required seconds.
This would have resulted in higher than usual timeout durations (10
seconds would have been sent as 1000000000 seconds since it duration
unmarshals to nanoseconds).

Updates all the instances of time duration handling in
`cloudflare_tunnel_config` resource to use the newly introduced
`TunnelDuration` to ensure we correctly setting the units.

[1]: golang/go#10275
@jacobbednarz jacobbednarz force-pushed the handle-tunnel-duration-in-paylods branch from 1937543 to 6423608 Compare June 22, 2023 03:53
@jacobbednarz
Copy link
Member Author

functional changes merged into #2541 to get CI green for version bumping

@jacobbednarz jacobbednarz merged commit f40c53f into master Jun 22, 2023
@jacobbednarz jacobbednarz deleted the handle-tunnel-duration-in-paylods branch June 22, 2023 03:56
@github-actions github-actions bot added this to the v4.9.0 milestone Jun 22, 2023
github-actions bot pushed a commit that referenced this pull request Jun 22, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v4.9.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 Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cloudflare_tunnel_config - ingress_rule - origin_request formating issue.
2 participants