-
Notifications
You must be signed in to change notification settings - Fork 630
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 terraform resource and data source for Infrastructure Access Target #4077
Add terraform resource and data source for Infrastructure Access Target #4077
Conversation
… internal/sdkv2provider is deprecated
…pes.ObjectValue and cloudflare.InfrastructureAccessTargetIPInfo
69b2cce
to
0a7c223
Compare
changelog detected ✅ |
resource.TestCheckResourceAttr("data.cloudflare_infrastructure_access_targets.all", "targets.1.ip.ipv4.ip_addr", "187.26.29.249"), | ||
resource.TestCheckResourceAttr("data.cloudflare_infrastructure_access_targets.all", "targets.1.ip.ipv4.virtual_network_id", "b9c90134-52de-4903-81e8-004a3a06b435"), | ||
resource.TestCheckResourceAttr("data.cloudflare_infrastructure_access_targets.all", "targets.1.ip.ipv6.ip_addr", "64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0"), | ||
resource.TestCheckResourceAttr("data.cloudflare_infrastructure_access_targets.all", "targets.1.ip.ipv6.virtual_network_id", "b9c90134-52de-4903-81e8-004a3a06b435"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after fixing this, i think this is a legit failure
=== RUN TestAccCloudflareInfraAccessTarget_DataSource
data_source_test.go:17: Step 2/2 error: Check failed: Check 9/10 error: data.cloudflare_infrastructure_access_targets.all: Attribute 'targets.1.ip.ipv6.ip_addr' not found
--- FAIL: TestAccCloudflareInfraAccessTarget_DataSource (4.29s)
FAIL
FAIL github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/infrastructure_access_target 5.389s
FAIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the second test manually and it's working as expected. Asserting in this case is tricky with multiple resources in the returned data source since there is no strict ordering. Removed the second test, it's not necessary.
internal/framework/service/infrastructure_access_target/resource_test.go
Outdated
Show resolved
Hide resolved
This functionality has been released in v4.43.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! |
Adds the resource and data source that we need to CRUDL infrastructure access target resources using the
cloudflare/cloudflare
terraform provider.Our OpenAPI schema is published in
cloudflare/api-schemas
viewable in this commitOur API docs are accessible in production at https://developers.cloudflare.com/api/operations/infra-targets-list
This PR is dependent on
cloudflare-go
client changes found in this PR -> cloudflare/cloudflare-go#3184New changes:
cloudflare_infrastructure_access_target
cloudflare_infrastructure_access_targets
Manual test cases covered for resources:
Manual test cases covered for data sources:
Manual testing setup:
sdadireddy/infrastructure-access
branch incloudflare-go
cloudflare-go
import in Interraform-provider-cloudflare
by addingreplace github.com/cloudflare/cloudflare-go => ../cloudflare-go
Replace the
cloudflare-go
ingo.mod
terraform-provider-cloudflare
, runmake build-dev
build a new binary with the new changes~/.terraformrc
to add a development override that points terraform to the directory with the compiled binary (should just be the root ofterraform-provider-cloudflare
main.tf
file to create a new resource as such:terraform init
andTF_LOG=DEBUG terraform plan
to see the proposed new changesTF_LOG=DEBUG terraform apply
and create the target