TPT-4479: Added support for Configurable VPC IPv4 Prefixes#2402
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Terraform support for configurable VPC IPv4 prefixes across the VPC resource and related data sources, and introduces a new data source for the GET /vpcs/default_ranges endpoint to expose default/forbidden IPv4 ranges.
Changes:
- Added
ipv4to the VPC framework resource/schema/models and implemented create/update handling for IPv4 ranges. - Extended VPC/VPCs data source coverage and acceptance test templates to validate the new
ipv4field. - Added a new
linode_vpc_default_rangesframework data source, docs, and CI integration-test suite coverage.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| linode/vpcs/tmpl/template.go | Extends VPCs test template data to include IPv4 range inputs. |
| linode/vpcs/tmpl/data_ipv4.gotf | Adds VPCs data source acceptance template exercising IPv4 output. |
| linode/vpcs/datasource_test.go | Adds acceptance coverage for linode_vpcs returning ipv4. |
| linode/vpcdefaultranges/tmpl/template.go | Adds helper to render the new default-ranges data source template. |
| linode/vpcdefaultranges/tmpl/data_basic.gotf | Adds basic HCL template for linode_vpc_default_ranges. |
| linode/vpcdefaultranges/framework_schema_datasource.go | Defines schema for default/forbidden IPv4 range sets. |
| linode/vpcdefaultranges/framework_models.go | Implements state model parsing for default/forbidden ranges. |
| linode/vpcdefaultranges/framework_datasource.go | Implements the new framework data source Read calling GetVPCDefaultRanges. |
| linode/vpcdefaultranges/datasource_test.go | Adds acceptance test for the new data source. |
| linode/vpc/tmpl/template.go | Adds VPC resource/data source templates for IPv4 range configs. |
| linode/vpc/tmpl/ipv4.gotf | Adds VPC resource template configuring a single IPv4 range. |
| linode/vpc/tmpl/ipv4_update.gotf | Adds VPC resource template configuring multiple IPv4 ranges (update scenario). |
| linode/vpc/tmpl/data_ipv4.gotf | Adds VPC data source template validating IPv4 output. |
| linode/vpc/resource_test.go | Adds acceptance coverage for VPC IPv4 create/update/import flows. |
| linode/vpc/framework_schema_resource.go | Adds ipv4 list nested attribute to the VPC resource schema. |
| linode/vpc/framework_schema_datasource.go | Adds ipv4 list nested attribute to the VPC data source schema attrs. |
| linode/vpc/framework_resource.go | Adds IPv4 create/update request mapping and mismatch validation. |
| linode/vpc/framework_models.go | Adds IPv4 flatten/copy logic for resource and data source models. |
| linode/vpc/datasource_test.go | Adds acceptance coverage for linode_vpc returning ipv4. |
| linode/lke/framework_datasource_test.go | Adjusts enterprise LKE data source test region selection logic. |
| linode/framework_provider.go | Registers the new linode_vpc_default_ranges framework data source. |
| docs/resources/vpc.md | Documents the new ipv4 argument and provides an example. |
| docs/data-sources/vpcs.md | Documents ipv4 output for the VPCs data source. |
| docs/data-sources/vpc.md | Documents ipv4 output for the VPC data source. |
| docs/data-sources/vpc_default_ranges.md | Adds documentation for the new default-ranges data source. |
| .github/workflows/integration_tests.yml | Adds vpcdefaultranges to the integration test suite list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| //enterpriseRegion, err := acceptance.GetRandomRegionWithCaps([]linodego.RegionCapability{"Kubernetes Enterprise", "VPCs"}, "core") | ||
| //if err != nil { | ||
| // t.Fatal(err) | ||
| //} | ||
| // TODO: Remove hard-coded region and replace with enterpriseRegion once capability filtering works properly | ||
| enterpriseRegionWithACLP := "us-lax" |
There was a problem hiding this comment.
I left it commented out intentionally so we can easily add it back later.
| knownvalue.StringExact("10.0.0.0/8"), | ||
| ), | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Do we need this TestStep? Isn't it a duplicate of the 1st one?
|
The test |
📝 Description
Added support for the new
ipv4field in the VPC resource/datasource and the VPCs datasource. Also added a new datasource for the newGET vpcs/default_rangesendpoint.✔️ How to Test
make test-int PKG_NAME="vpc" TEST_CASE="TestAccDataSourceVPC_ipv4"make test-int PKG_NAME="vpc" TEST_CASE="TestAccResourceVPC_ipv4"make test-int PKG_NAME="vpcdefaultranges" TEST_CASE="TestAccDataSourceVPCDefaultRanges_basic"make test-int PKG_NAME="vpcs" TEST_CASE="TestAccDataSourceVPCs_ipv4"I also fixed an unrelated LKE test that was failing:
make test-int PKG_NAME="lke" TEST_CASE="TestAccDataSourceLKECluster_enterprise"