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

Adds support for Magic Transit GRE tunnels #1423

Merged
merged 3 commits into from
Feb 14, 2022

Conversation

cehrig
Copy link

@cehrig cehrig commented Feb 2, 2022

This PR adds a new resource for managing GRE tunnels. The resource layout looks as follows:

resource "cloudflare_gre_tunnel" "example" {
  account_id              = "c4a7362d577a6c3019a474fd6f485821"
  name                    = "GRE_1"
  customer_gre_endpoint   = "203.0.113.1"
  cloudflare_gre_endpoint = "203.0.113.1"
  interface_address       = "192.0.2.0/31"
  description             = "Tunnel for ISP X"
  ttl                     = 64
  mtu                     = 1476
  health_check_enabled    = true
  health_check_target     = "203.0.113.1"
  health_check_type       = "reply"
}

cloudflare/cloudflare-go#798 is required for this to work. The provided acceptance tests will only work when using an account with Magic Transit enabled. They have been tested against a production account:

$ go test $(go list ./...) -v -run TestAccCloudflareGRE
?       github.com/cloudflare/terraform-provider-cloudflare     [no test files]
=== RUN   TestAccCloudflareGRETunnelExists
--- PASS: TestAccCloudflareGRETunnelExists (30.11s)
=== RUN   TestAccCloudflareGRETunnelUpdateDescription
--- PASS: TestAccCloudflareGRETunnelUpdateDescription (46.98s)
=== RUN   TestAccCloudflareGRETunnelUpdateMulti
--- PASS: TestAccCloudflareGRETunnelUpdateMulti (53.26s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/cloudflare  130.362s
?       github.com/cloudflare/terraform-provider-cloudflare/tools/cmd/changelog-check   [no test files]
?       github.com/cloudflare/terraform-provider-cloudflare/version     [no test files]

@github-actions
Copy link

github-actions bot commented Feb 2, 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.

@jacobbednarz jacobbednarz added kind/enhancement Categorizes issue or PR as related to improving an existing feature. workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library. service/magic_transit Categorizes issue or PR as related to Magic Transit suite of services. labels Feb 3, 2022
@jacobbednarz
Copy link
Member

jacobbednarz commented Feb 11, 2022

@cehrig i had to cast MTU and TTL to an int in 9c24b04 as uint{8,16} are incompatible with d.Set (see https://github.com/cloudflare/terraform-provider-cloudflare/runs/5151807097?check_suite_focus=true#step:4:230). would you mind re-running these tests now that i've pulled in the latest cloudflare-go changes and we can get this out?

@jacobbednarz jacobbednarz removed the workflow/pending-upstream-library Indicates an issue or PR requires changes from an upstream library. label Feb 11, 2022
@cehrig
Copy link
Author

cehrig commented Feb 13, 2022

Weird, now I am wondering why I did not run into that issue.
Tests are running fine

$ go test $(go list ./...) -v -run TestAccCloudflareGRE
?       github.com/cloudflare/terraform-provider-cloudflare     [no test files]
=== RUN   TestAccCloudflareGRETunnelExists
--- PASS: TestAccCloudflareGRETunnelExists (32.14s)
=== RUN   TestAccCloudflareGRETunnelUpdateDescription
--- PASS: TestAccCloudflareGRETunnelUpdateDescription (50.93s)
=== RUN   TestAccCloudflareGRETunnelUpdateMulti
--- PASS: TestAccCloudflareGRETunnelUpdateMulti (54.20s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/cloudflare  137.278s
?       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 290c657 into cloudflare:master Feb 14, 2022
@jacobbednarz
Copy link
Member

the type incompatibility was picked up by tfproviderlintx which runs on pull requests but requires explicit running locally via make terraform-provider-lint. there is make lint that runs everything but may be a little noisy since tools like golangci-lint only checks current changes, not everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to improving an existing feature. service/magic_transit Categorizes issue or PR as related to Magic Transit suite of services.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants