Bug: Converts stack tag name spaces to underscores
Description:
In a recent version we were able to add tags in the toml file with spaces in the names -> these tags were added with no modification to resources.
In the current version it replaces spaces with an underscore:
samconfig.toml
[staging]
[staging.deploy]
[staging.deploy.parameters]
stack_name = "shop-restack-ecs-stack"
region = "eu-central-1"
confirm_changeset = true
capabilities = "CAPABILITY_NAMED_IAM"
tags = 'Env=staging Repo=shop-restack Stack=shop-restack-ecs-stack "Cost Group"=Restack'
I have tried with various formats of the tags arg with the same or worse results.
eg:
tags = "Env=staging Repo=shop-restack Stack=shop-restack-ecs-stack \"Cost Group\"=Restack"
tags = "Env=staging Repo=shop-restack Stack=shop-restack-ecs-stack 'Cost Group'=Restack"
tags = "Env=staging Repo=shop-restack Stack=shop-restack-ecs-stack Cost Group=Restack"
Note: spaces are explicitly allowed: https://docs.aws.amazon.com/tag-editor/latest/userguide/best-practices-and-strats.html#:~:text=For%20information%20about%20what%20characters,and%20values%20are%20case%20sensitive.
This change is breaking out cost allocation tags, and breaking our CI scripts.
Steps to reproduce:
Using 1.132.0 Windows.
- Add tags to the toml file with a space in a tag name.
- Deploy with sam deploy
Observed result:
Replaces the tag with an underscore.
Cost Group -> Cost_Group
Expected result:
Creates the tag with the same name set in the samconfig.toml file.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows
-
sam --version: 1.132.0 - AWS region: eu-central-1
{
"version": "1.132.0",
"system": {
"python": "3.12.6",
"os": "Windows-10-10.0.19045-SP0"
},
"additional_dependencies": {
"docker_engine": "24.0.7",
"aws_cdk": "Not available",
"terraform": "1.3.5"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
After more experimenting, this pattern seems to work:
tags = [
"Env=prod",
"Repo=shop-restack",
"Stack=shop-restack-ecs-stack",
"Cost Group=Restack"
]
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
On second thought, best to keep this open since behaviour is not as expected.
I assume the last working version for your was 1.131.0 Is that correct?
That sounds about right.
I mark this issue as stage/needs-feedback to collect more reaction from community.