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 virtual networks #1672

Merged
merged 10 commits into from Jun 10, 2022

Conversation

vavsab
Copy link
Contributor

@vavsab vavsab commented Jun 3, 2022

Add missing vnet resource

Related issues: #1602 cloudflare/cloudflare-go#913

Closes #1602

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2022

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2022

This project handles dependency version bumps (including upstream changes from cloudflare-go) independently of the standard PR process using automation. This allows the dependency upgrades to land without causing merge conflicts in multiple branches and handled in a consistent way. The exception to this is security related dependency upgrades but they should be co-ordinated with the maintainer team privately.

Please remove the changes to the go.mod or go.sum files from this PR in order to proceed with review and merging.

@vavsab vavsab marked this pull request as ready for review June 8, 2022 07:15
@vavsab vavsab requested a review from jacobbednarz as a code owner June 8, 2022 07:15
@jacobbednarz
Copy link
Member

as this is a new resource, can you please swap over to using the autogenerated docs by following the example in #1677? it should only require:

  • adding the descriptions to the schema fields
  • adding either example usage
  • adding the import example
  • running make docs

I'll review the functionality in the AM.

@vavsab
Copy link
Contributor Author

vavsab commented Jun 8, 2022

as this is a new resource, can you please swap over to using the autogenerated docs by following the example in #1677? it should only require:

  • adding the descriptions to the schema fields
  • adding either example usage
  • adding the import example
  • running make docs

I'll review the functionality in the AM.

@jacobbednarz created examples and generated the docs

@@ -0,0 +1 @@
terraform import cloudflare_tunnel_virtual_network c4a7362d577a6c3019a474fd6f485821/3c8ff8af-b487-45bd-89e3-4c85a1532600
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
terraform import cloudflare_tunnel_virtual_network c4a7362d577a6c3019a474fd6f485821/3c8ff8af-b487-45bd-89e3-4c85a1532600
$ terraform import cloudflare_tunnel_virtual_network c4a7362d577a6c3019a474fd6f485821/3c8ff8af-b487-45bd-89e3-4c85a1532600

@jacobbednarz
Copy link
Member

looks like the update comment test is failing

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTunnelVirtualNetwork_" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTunnelVirtualNetwork_Exists
--- PASS: TestAccCloudflareTunnelVirtualNetwork_Exists (14.70s)
=== RUN   TestAccCloudflareTunnelVirtualNetwork_UpdateComment
    resource_cloudflare_tunnel_virtual_network_test.go:118: Step 2/2 error: Error running apply: exit status 1

        Error: error updating Tunnel Virtual Network "4760e5b2-c737-4b8d-98f9-9ce33b581d7c": error unmarshalling the JSON response error body: unexpected end of JSON input

          with cloudflare_tunnel_virtual_network.xuysfsklky,
          on terraform_plugin_test.tf line 2, in resource "cloudflare_tunnel_virtual_network" "xuysfsklky":
           2: resource "cloudflare_tunnel_virtual_network" "xuysfsklky" {

--- FAIL: TestAccCloudflareTunnelVirtualNetwork_UpdateComment (18.02s)
FAIL
FAIL	github.com/cloudflare/terraform-provider-cloudflare/internal/provider	33.292s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/maintainer-only-file-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/tf-log-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]
FAIL
make: *** [testacc] Error 1

from the HTTP traffic, it looks like the virtual network ID is missing in the PATCH request.

@jacobbednarz
Copy link
Member

couple of small things and we can get this one merged in

@vavsab
Copy link
Contributor Author

vavsab commented Jun 9, 2022

Forgot that I have 2 acceptance tests...
All green now.
image

@vavsab vavsab requested a review from jacobbednarz June 9, 2022 10:28
@jacobbednarz
Copy link
Member

acceptance tests all passing here

TF_ACC=1 go test $(go list ./...) -v -run "^TestAccCloudflareTunnelVirtualNetwork_" -count 1 -parallel 1 -timeout 120m -parallel 1
?   	github.com/cloudflare/terraform-provider-cloudflare	[no test files]
=== RUN   TestAccCloudflareTunnelVirtualNetwork_Exists
--- PASS: TestAccCloudflareTunnelVirtualNetwork_Exists (13.33s)
=== RUN   TestAccCloudflareTunnelVirtualNetwork_UpdateComment
--- PASS: TestAccCloudflareTunnelVirtualNetwork_UpdateComment (24.03s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/provider	37.941s
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/maintainer-only-file-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/tf-log-check	[no test files]
?   	github.com/cloudflare/terraform-provider-cloudflare/version	[no test files]

thanks for getting this over the line!

@jacobbednarz jacobbednarz merged commit 64d13cb into cloudflare:master Jun 10, 2022
@github-actions github-actions bot added this to the v3.17.0 milestone Jun 10, 2022
@github-actions
Copy link
Contributor

This functionality has been released in v3.17.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!

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.

Feature: add cloudflare_tunnel_virtual_network resource
2 participants