Skip to content

Commit 59881e8

Browse files
authored
chore(container/function): namespace: deprecate activate_vpc_integration (#3286)
* chore(container/function): namespace: deprecate activate_vpc_integration attribute * set ActivateVpcIntegration to true in request for cassette matching * record all cassettes from scope * update expires_at hardcoded value
1 parent 4f6be9f commit 59881e8

File tree

53 files changed

+24866
-20895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+24866
-20895
lines changed

docs/resources/container_namespace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ The following arguments are supported:
4040

4141
- `secret_environment_variables` - (Optional) The secret environment variables of the namespace.
4242

43-
- `activate_vpc_integration` - (Optional) Activates VPC integration for the namespace. Containers of a namespace with VPC integration activated will be able to connect to a Private Network.
43+
- `activate_vpc_integration` - (Deprecated) Activates VPC integration for the namespace. Containers of a namespace with VPC integration activated will be able to connect to a Private Network.
4444

45-
~> **Important** Updates to `activate_vpc_integration` will recreate the namespace.
45+
~> **Important:** VPC integration is now available on all namespaces, so this field is not configurable anymore and its value will always be "true".
4646

4747
## Attributes Reference
4848

docs/resources/function_namespace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ The following arguments are supported:
4040

4141
- `secret_environment_variables` - (Optional) The secret environment variables of the namespace.
4242

43-
- `activate_vpc_integration` - (Optional) Activates VPC integration for the namespace. Functions of a namespace with VPC integration activated will be able to connect to a Private Network.
43+
- `activate_vpc_integration` - (Deprecated) Activates VPC integration for the namespace. Functions of a namespace with VPC integration activated will be able to connect to a Private Network.
4444

45-
~> **Important** Updates to `activate_vpc_integration` will recreate the namespace.
45+
~> **Important:** VPC integration is now available on all namespaces, so this field is not configurable anymore and its value will always be "true".
4646

4747
## Attributes Reference
4848

internal/services/container/namespace.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ func ResourceNamespace() *schema.Resource {
9797
},
9898
"activate_vpc_integration": {
9999
Type: schema.TypeBool,
100-
ForceNew: true,
100+
Deprecated: "VPC integration is now available on all namespaces, so this field is not configurable anymore and its value will always be \"true\".",
101101
Optional: true,
102-
Default: false,
102+
Default: true,
103103
Description: "Activate VPC integration for the namespace",
104104
},
105105
"region": regional.Schema(),
@@ -122,17 +122,14 @@ func ResourceContainerNamespaceCreate(ctx context.Context, d *schema.ResourceDat
122122
Name: types.ExpandOrGenerateString(d.Get("name").(string), "ns"),
123123
ProjectID: d.Get("project_id").(string),
124124
Region: region,
125+
ActivateVpcIntegration: true,
125126
}
126127

127128
rawTag, tagExist := d.GetOk("tags")
128129
if tagExist {
129130
createReq.Tags = types.ExpandStrings(rawTag)
130131
}
131132

132-
if activateVPC, ok := d.GetOk("activate_vpc_integration"); ok {
133-
createReq.ActivateVpcIntegration = activateVPC.(bool)
134-
}
135-
136133
ns, err := api.CreateNamespace(createReq, scw.WithContext(ctx))
137134
if err != nil {
138135
return diag.FromErr(err)

internal/services/container/namespace_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package container_test
22

33
import (
44
"fmt"
5-
"regexp"
65
"testing"
76

87
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
@@ -295,24 +294,10 @@ func TestAccNamespace_VPCIntegration(t *testing.T) {
295294
`,
296295
Check: resource.ComposeTestCheckFunc(
297296
isNamespacePresent(tt, "scaleway_container_namespace.main"),
298-
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "false"),
297+
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "true"),
299298
acctest.CheckResourceIDPersisted("scaleway_container_namespace.main", &namespaceID),
300299
),
301300
},
302-
{
303-
Config: `
304-
resource scaleway_vpc_private_network main {}
305-
306-
resource scaleway_container_namespace main {}
307-
308-
resource scaleway_container main {
309-
namespace_id = scaleway_container_namespace.main.id
310-
private_network_id = scaleway_vpc_private_network.main.id
311-
sandbox = "v1"
312-
}
313-
`,
314-
ExpectError: regexp.MustCompile("Application can't be attached to private network, vpc integration must be activated on its parent namespace"),
315-
},
316301
{
317302
Config: `
318303
resource scaleway_vpc_private_network main {}
@@ -332,7 +317,7 @@ func TestAccNamespace_VPCIntegration(t *testing.T) {
332317
isContainerPresent(tt, "scaleway_container.main"),
333318
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "true"),
334319
resource.TestCheckResourceAttrPair("scaleway_container.main", "private_network_id", "scaleway_vpc_private_network.main", "id"),
335-
acctest.CheckResourceIDChanged("scaleway_container_namespace.main", &namespaceID),
320+
acctest.CheckResourceIDPersisted("scaleway_container_namespace.main", &namespaceID),
336321
),
337322
},
338323
},

0 commit comments

Comments
 (0)