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
4 changes: 2 additions & 2 deletions docs/resources/container_namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ The following arguments are supported:

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

- `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.
- `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.

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

## Attributes Reference

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/function_namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ The following arguments are supported:

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

- `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.
- `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.

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

## Attributes Reference

Expand Down
9 changes: 3 additions & 6 deletions internal/services/container/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ func ResourceNamespace() *schema.Resource {
},
"activate_vpc_integration": {
Type: schema.TypeBool,
ForceNew: true,
Deprecated: "VPC integration is now available on all namespaces, so this field is not configurable anymore and its value will always be \"true\".",
Optional: true,
Default: false,
Default: true,
Description: "Activate VPC integration for the namespace",
},
"region": regional.Schema(),
Expand All @@ -122,17 +122,14 @@ func ResourceContainerNamespaceCreate(ctx context.Context, d *schema.ResourceDat
Name: types.ExpandOrGenerateString(d.Get("name").(string), "ns"),
ProjectID: d.Get("project_id").(string),
Region: region,
ActivateVpcIntegration: true,
}

rawTag, tagExist := d.GetOk("tags")
if tagExist {
createReq.Tags = types.ExpandStrings(rawTag)
}

if activateVPC, ok := d.GetOk("activate_vpc_integration"); ok {
createReq.ActivateVpcIntegration = activateVPC.(bool)
}

ns, err := api.CreateNamespace(createReq, scw.WithContext(ctx))
if err != nil {
return diag.FromErr(err)
Expand Down
19 changes: 2 additions & 17 deletions internal/services/container/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package container_test

import (
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -295,24 +294,10 @@ func TestAccNamespace_VPCIntegration(t *testing.T) {
`,
Check: resource.ComposeTestCheckFunc(
isNamespacePresent(tt, "scaleway_container_namespace.main"),
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "false"),
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "true"),
acctest.CheckResourceIDPersisted("scaleway_container_namespace.main", &namespaceID),
),
},
{
Config: `
resource scaleway_vpc_private_network main {}

resource scaleway_container_namespace main {}

resource scaleway_container main {
namespace_id = scaleway_container_namespace.main.id
private_network_id = scaleway_vpc_private_network.main.id
sandbox = "v1"
}
`,
ExpectError: regexp.MustCompile("Application can't be attached to private network, vpc integration must be activated on its parent namespace"),
},
{
Config: `
resource scaleway_vpc_private_network main {}
Expand All @@ -332,7 +317,7 @@ func TestAccNamespace_VPCIntegration(t *testing.T) {
isContainerPresent(tt, "scaleway_container.main"),
resource.TestCheckResourceAttr("scaleway_container_namespace.main", "activate_vpc_integration", "true"),
resource.TestCheckResourceAttrPair("scaleway_container.main", "private_network_id", "scaleway_vpc_private_network.main", "id"),
acctest.CheckResourceIDChanged("scaleway_container_namespace.main", &namespaceID),
acctest.CheckResourceIDPersisted("scaleway_container_namespace.main", &namespaceID),
),
},
},
Expand Down
Loading
Loading