Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

norbjd
Copy link
Contributor

@norbjd norbjd commented Nov 15, 2024

Hello,

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

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

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 norbjd self-assigned this Nov 15, 2024
@github-actions github-actions bot added container Container issues, bugs and feature requests function Serverless function issues, bugs and feature requests labels Nov 15, 2024
@norbjd
Copy link
Contributor Author

norbjd commented Nov 15, 2024

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
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@Codelax Codelax added this pull request to the merge queue Nov 20, 2024
Merged via the queue into scaleway:master with commit 6f6860e Nov 20, 2024
40 of 41 checks passed
@norbjd norbjd deleted the serverless-support-namespaces-tags branch November 20, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
container Container issues, bugs and feature requests function Serverless function issues, bugs and feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants