Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/data-sources/vpcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ In addition to all arguments above, the following attributes are exported:
- `updated_at` - Date and time of VPC's last update (RFC 3339 format).
- `organization_id` - The Organization ID the VPC is associated with.
- `project_id` - The ID of the Project the VPC is associated with.
- `enable_routing` - Defines whether routing between Private Networks in the VPC is enabled.
- `enable_custom_routes_propagation` - Defines whether the VPC advertises custom routes between its Private Networks.
1 change: 1 addition & 0 deletions docs/resources/vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following arguments are supported:
- `name` - (Optional) The name for the VPC. If not provided it will be randomly generated.
- `tags` - (Optional) The tags to associate with the VPC.
- `enable_routing` - (Optional) Enable routing between Private Networks in the VPC. Note that you will not be able to deactivate it afterwards.
- `enable_custom_routes_propagation` - (`true` for newly created VPCs) Defines whether the VPC advertises custom routes between its Private Networks. Note that you will not be able to deactivate it afterwards.
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) of the VPC.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the VPC is associated with.

Expand Down
1 change: 1 addition & 0 deletions docs/resources/vpc_private_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The following arguments are supported:
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) of the Private Network.
- `vpc_id` - (Optional) The VPC in which to create the Private Network.
- `is_regional` - (Deprecated) Private Networks are now all necessarily regional.
- `enable_default_route_propagation` - (Optional) Defines whether default v4 and v6 routes are propagated for this Private Network.
- `zone` - (Deprecated) Use `region` instead.

## Attributes Reference
Expand Down
2,291 changes: 1,270 additions & 1,021 deletions internal/services/applesilicon/testdata/server-enable-vpc.cassette.yaml

Large diffs are not rendered by default.

1,433 changes: 693 additions & 740 deletions internal/services/instance/testdata/private-nic-with-ipam.cassette.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,887 changes: 920 additions & 967 deletions internal/services/ipam/testdata/data-source-ipamip-instance-lb.cassette.yaml

Large diffs are not rendered by default.

1,565 changes: 710 additions & 855 deletions internal/services/ipam/testdata/data-source-ipamip-instance.cassette.yaml

Large diffs are not rendered by default.

421 changes: 236 additions & 185 deletions internal/services/ipam/testdata/data-source-ipamipid.cassette.yaml

Large diffs are not rendered by default.

560 changes: 281 additions & 279 deletions internal/services/ipam/testdata/data-source-ipamiprdb.cassette.yaml

Large diffs are not rendered by default.

345 changes: 198 additions & 147 deletions internal/services/ipam/testdata/ipamip-basic.cassette.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

585 changes: 318 additions & 267 deletions internal/services/ipam/testdata/ipamip-with-tags.cassette.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2,518 changes: 1,406 additions & 1,112 deletions internal/services/rdb/testdata/instance-private-network-update.cassette.yaml

Large diffs are not rendered by default.

1,964 changes: 1,179 additions & 785 deletions internal/services/rdb/testdata/instance-private-network.cassette.yaml

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions internal/services/vpc/private_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ func ResourcePrivateNetwork() *schema.Resource {
ForceNew: true,
Description: "The VPC in which to create the private network",
},
"enable_default_route_propagation": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Defines whether default v4 and v6 routes are propagated for this Private Network",
},
"project_id": account.ProjectIDSchema(),
"zone": {
Type: schema.TypeString,
Expand Down Expand Up @@ -197,10 +203,11 @@ func ResourceVPCPrivateNetworkCreate(ctx context.Context, d *schema.ResourceData
}

req := &vpc.CreatePrivateNetworkRequest{
Name: types.ExpandOrGenerateString(d.Get("name"), "pn"),
Tags: types.ExpandStrings(d.Get("tags")),
ProjectID: d.Get("project_id").(string),
Region: region,
Name: types.ExpandOrGenerateString(d.Get("name"), "pn"),
Tags: types.ExpandStrings(d.Get("tags")),
DefaultRoutePropagationEnabled: d.Get("enable_default_route_propagation").(bool),
ProjectID: d.Get("project_id").(string),
Region: region,
}

if _, ok := d.GetOk("vpc_id"); ok {
Expand Down Expand Up @@ -258,6 +265,7 @@ func ResourceVPCPrivateNetworkRead(ctx context.Context, d *schema.ResourceData,
_ = d.Set("created_at", types.FlattenTime(pn.CreatedAt))
_ = d.Set("updated_at", types.FlattenTime(pn.UpdatedAt))
_ = d.Set("tags", pn.Tags)
_ = d.Set("enable_default_route_propagation", pn.DefaultRoutePropagationEnabled)
_ = d.Set("region", region)
_ = d.Set("is_regional", true)
_ = d.Set("zone", zone)
Expand All @@ -276,10 +284,11 @@ func ResourceVPCPrivateNetworkUpdate(ctx context.Context, d *schema.ResourceData
}

_, err = vpcAPI.UpdatePrivateNetwork(&vpc.UpdatePrivateNetworkRequest{
PrivateNetworkID: ID,
Region: region,
Name: scw.StringPtr(d.Get("name").(string)),
Tags: types.ExpandUpdatedStringsPtr(d.Get("tags")),
PrivateNetworkID: ID,
Region: region,
Name: scw.StringPtr(d.Get("name").(string)),
Tags: types.ExpandUpdatedStringsPtr(d.Get("tags")),
DefaultRoutePropagationEnabled: types.ExpandBoolPtr(d.Get("enable_default_route_propagation").(bool)),
}, scw.WithContext(ctx))
if err != nil {
return diag.FromErr(err)
Expand Down
15 changes: 13 additions & 2 deletions internal/services/vpc/private_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ func TestAccVPCPrivateNetwork_Basic(t *testing.T) {
"region",
"fr-par",
),
resource.TestCheckResourceAttr(
"scaleway_vpc_private_network.pn01",
"enable_default_route_propagation",
"false",
),
),
},
{
Config: fmt.Sprintf(`
resource scaleway_vpc_private_network pn01 {
name = "%s"
tags = ["tag0", "tag1"]
name = "%s"
tags = ["tag0", "tag1"]
enable_default_route_propagation = true
}
`, privateNetworkName),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -67,6 +73,11 @@ func TestAccVPCPrivateNetwork_Basic(t *testing.T) {
"tags.1",
"tag1",
),
resource.TestCheckResourceAttr(
"scaleway_vpc_private_network.pn01",
"enable_default_route_propagation",
"true",
),
),
},
},
Expand Down
Loading
Loading