scaleway / terraform-provider-scaleway

Terraform Scaleway provider
https://www.terraform.io/docs/providers/scaleway/
Mozilla Public License 2.0
199 stars 125 forks source link

feat(serverless): add support for tags on functions/containers namespaces #2807

Closed norbjd closed 2 days ago

norbjd commented 1 week ago

Hello,

Go SDK now supports tags on functions and container namespaces since https://github.com/scaleway/scaleway-sdk-go/commit/2a48843b5fcba4ab5624b25ebe1dc79cae5fdac1 (hence the bump in go.mod). This PR adds support in Terraform for these fields in both functions and containers namespaces.

:warning: please wait 2024/11/19 before merging, but this doesn't prevent from reviewing :warning:

Tested with a local build of the provider and the following config:

resource "scaleway_container_namespace" "main" {
  name = "test"
  tags = ["tag1", "tag2"]
}

resource "scaleway_function_namespace" "main" {
  name = "test"
  tags = ["tag1", "tag2", "tag3"]
}

After terraform applying, tags are added to the namespaces.

For containers:

$ curl -s -H "X-Auth-Token: $SCW_SECRET_KEY" $SCW_API_URL/containers/v1beta1/regions/$SCW_DEFAULT_REGION/namespaces | jq '.namespaces[] | {"name": .name, "tags": .tags}'
{
  "name": "test",
  "tags": [
    "tag1",
    "tag2"
  ]
}

For functions:

$ curl -s -H "X-Auth-Token: $SCW_SECRET_KEY" $SCW_API_URL/functions/v1beta1/regions/$SCW_DEFAULT_REGION/namespaces | jq '.namespaces[] | {"name": .name, "tags": .tags}'
{
  "name": "test",
  "tags: [
    "tag1",
    "tag2",
    "tag3"
  ]
}

I have also tested that there are no regressions if we don't add tags at all, and added an acceptance test.

Thanks.

norbjd commented 1 week ago

Cassettes are not up to date, hence the error in tests I believe. I don't know how to properly update the cassettes. Also, lint is failing for unrelated reasons (deprecation of another field).

codecov-commenter commented 2 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.69%. Comparing base (fe86049) to head (a810293). Report is 226 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2807 +/- ## ========================================== - Coverage 71.43% 67.69% -3.75% ========================================== Files 277 339 +62 Lines 35875 39963 +4088 ========================================== + Hits 25628 27051 +1423 - Misses 8028 10598 +2570 - Partials 2219 2314 +95 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: