Skip to content

Commit 5ccd54f

Browse files
authored
Fix ssm and asm uri (#11)
1 parent 5702bb9 commit 5ccd54f

5 files changed

Lines changed: 42 additions & 42 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ usage: |-
3030
secrets:
3131
MY_SECRET: "my-secret-value"
3232
MY_SECRET_2: "nacl:dGVzdC12YWx1ZS0yCg=="
33-
MY_SECRET_3: "ssm:/my/secret/path"
34-
MY_SECRET_4: "sm:secret-name"
33+
MY_SECRET_3: "ssm:///my/secret/path"
34+
MY_SECRET_4: "asm://secret-name"
3535
variables:
3636
MY_VARIABLE: "my-variable-value"
37-
MY_VARIABLE_2: "ssm:/my/variable/path"
38-
MY_VARIABLE_3: "sm:variable-name"
37+
MY_VARIABLE_2: "ssm:///my/variable/path"
38+
MY_VARIABLE_3: "asm://variable-name"
3939
```
4040
4141
## Secrets and variables
4242
4343
The component supports setting repository and environment secrets and variables.
4444
Secrets and variables can be set using the following methods:
4545
- Raw values (unencrypted string) (example: `my-secret-value`)
46-
- AWS Secrets Manager (SM) (example: `sm:secret-name`)
47-
- AWS Systems Manager Parameter Store (SSM) (example: `ssm:/my/secret/path`)
46+
- AWS Secrets Manager (SM) (example: `asm://secret-name`)
47+
- AWS Systems Manager Parameter Store (SSM) (example: `ssm:///my/secret/path`)
4848
4949
In addition to that secrets supports base64 encoded values [encrypted](https://docs.github.com/en/rest/guides/encrypting-secrets-for-the-rest-api?apiVersion=2022-11-28)
5050
with [repository key](https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#get-a-repository-public-key).

src/README.md

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.tf

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ module "repository" {
7474
locals {
7575
secrets = sensitive({
7676
for k, v in coalesce(var.secrets, {}) : k => (
77-
startswith(v, "ssm:") ? data.aws_ssm_parameter.default[v].value :
78-
startswith(v, "sm:") ? data.aws_secretsmanager_secret_version.default[v].secret_string : v
77+
startswith(v, "ssm://") ? data.aws_ssm_parameter.default[v].value :
78+
startswith(v, "asm://") ? data.aws_secretsmanager_secret_version.default[v].secret_string : v
7979
)
8080
})
8181

8282
variables = {
8383
for k, v in try(var.variables, {}) : k => (
84-
startswith(v, "ssm:") ? nonsensitive(data.aws_ssm_parameter.default[v].value) :
85-
startswith(v, "sm:") ? nonsensitive(data.aws_secretsmanager_secret_version.default[v].secret_string) : v
84+
startswith(v, "ssm://") ? nonsensitive(data.aws_ssm_parameter.default[v].value) :
85+
startswith(v, "asm://") ? nonsensitive(data.aws_secretsmanager_secret_version.default[v].secret_string) : v
8686
)
8787
}
8888

@@ -93,14 +93,14 @@ locals {
9393
prevent_self_review = v.prevent_self_review
9494
variables = {
9595
for name, variable in coalesce(v.variables, {}) : name => (
96-
startswith(variable, "ssm:") ? nonsensitive(data.aws_ssm_parameter.default[variable].value) :
97-
startswith(variable, "sm:") ? nonsensitive(data.aws_secretsmanager_secret_version.default[variable].secret_string) : variable
96+
startswith(variable, "ssm://") ? nonsensitive(data.aws_ssm_parameter.default[variable].value) :
97+
startswith(variable, "asm://") ? nonsensitive(data.aws_secretsmanager_secret_version.default[variable].secret_string) : variable
9898
)
9999
}
100100
secrets = {
101101
for name, secret in coalesce(v.secrets, {}) : name => (
102-
startswith(secret, "ssm:") ? nonsensitive(data.aws_ssm_parameter.default[secret].value) :
103-
startswith(secret, "sm:") ? nonsensitive(data.aws_secretsmanager_secret_version.default[secret].secret_string) : secret
102+
startswith(secret, "ssm://") ? nonsensitive(data.aws_ssm_parameter.default[secret].value) :
103+
startswith(secret, "asm://") ? nonsensitive(data.aws_secretsmanager_secret_version.default[secret].secret_string) : secret
104104
)
105105
}
106106
}
@@ -109,20 +109,20 @@ locals {
109109
ssm_parameters = merge(flatten([
110110
[
111111
{
112-
for k, v in coalesce(var.variables, {}) : v => trimprefix(v, "ssm:") if startswith(v, "ssm:")
112+
for k, v in coalesce(var.variables, {}) : v => trimprefix(v, "ssm://") if startswith(v, "ssm://")
113113
},
114114
{
115-
for k, v in coalesce(var.secrets, {}) : v => trimprefix(v, "ssm:") if startswith(v, "ssm:")
115+
for k, v in coalesce(var.secrets, {}) : v => trimprefix(v, "ssm://") if startswith(v, "ssm://")
116116
},
117117
],
118118
[
119119
for k, v in coalesce(var.environments, {}) : {
120-
for name, variable in coalesce(v.variables, {}) : variable => trimprefix(variable, "ssm:") if startswith(variable, "ssm:")
120+
for name, variable in coalesce(v.variables, {}) : variable => trimprefix(variable, "ssm://") if startswith(variable, "ssm://")
121121
}
122122
],
123123
[
124124
for k, v in coalesce(var.environments, {}) : {
125-
for name, secret in coalesce(v.secrets, {}) : secret => trimprefix(secret, "ssm:") if startswith(secret, "ssm:")
125+
for name, secret in coalesce(v.secrets, {}) : secret => trimprefix(secret, "ssm://") if startswith(secret, "ssm://")
126126
}
127127
]
128128
])...)
@@ -131,20 +131,20 @@ locals {
131131
sm_parameters = merge(flatten([
132132
[
133133
{
134-
for k, v in coalesce(var.variables, {}) : v => trimprefix(v, "sm:") if startswith(v, "sm:")
134+
for k, v in coalesce(var.variables, {}) : v => trimprefix(v, "asm://") if startswith(v, "asm://")
135135
},
136136
{
137-
for k, v in coalesce(var.secrets, {}) : v => trimprefix(v, "sm:") if startswith(v, "sm:")
137+
for k, v in coalesce(var.secrets, {}) : v => trimprefix(v, "asm://") if startswith(v, "asm://")
138138
},
139139
],
140140
[
141141
for k, v in coalesce(var.environments, {}) : {
142-
for name, variable in coalesce(v.variables, {}) : variable => trimprefix(variable, "sm:") if startswith(variable, "sm:")
142+
for name, variable in coalesce(v.variables, {}) : variable => trimprefix(variable, "asm://") if startswith(variable, "asm://")
143143
}
144144
],
145145
[
146146
for k, v in coalesce(var.environments, {}) : {
147-
for name, secret in coalesce(v.secrets, {}) : secret => trimprefix(secret, "sm:") if startswith(secret, "sm:")
147+
for name, secret in coalesce(v.secrets, {}) : secret => trimprefix(secret, "asm://") if startswith(secret, "asm://")
148148
}
149149
]
150150
])...)

test/component_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ func (s *ComponentSuite) TestBasic() {
8787
},
8888
},
8989
"variables": map[string]interface{}{
90-
"test_variable": fmt.Sprintf("ssm:%s", ssmSecretPath),
91-
"test_variable_2": fmt.Sprintf("sm:%s", createdSecretName),
90+
"test_variable": fmt.Sprintf("ssm://%s", ssmSecretPath),
91+
"test_variable_2": fmt.Sprintf("asm://%s", createdSecretName),
9292
},
9393
"secrets": map[string]interface{}{
94-
"test_secret": fmt.Sprintf("ssm:%s", ssmSecretPath),
95-
"test_secret_2": fmt.Sprintf("sm:%s", createdSecretName),
94+
"test_secret": fmt.Sprintf("ssm://%s", ssmSecretPath),
95+
"test_secret_2": fmt.Sprintf("asm://%s", createdSecretName),
9696
},
9797
"environments": map[string]interface{}{
9898
"development": map[string]interface{}{
@@ -124,12 +124,12 @@ func (s *ComponentSuite) TestBasic() {
124124
"can_admins_bypass": false,
125125
"prevent_self_review": false,
126126
"variables": map[string]interface{}{
127-
"test_variable": fmt.Sprintf("ssm:%s", ssmSecretPath),
128-
"test_variable_2": fmt.Sprintf("sm:%s", smSecretPath),
127+
"test_variable": fmt.Sprintf("ssm://%s", ssmSecretPath),
128+
"test_variable_2": fmt.Sprintf("asm://%s", smSecretPath),
129129
},
130130
"secrets": map[string]interface{}{
131-
"test_secret": fmt.Sprintf("ssm:%s", ssmSecretPath),
132-
"test_secret_2": fmt.Sprintf("sm:%s", smSecretPath),
131+
"test_secret": fmt.Sprintf("ssm://%s", ssmSecretPath),
132+
"test_secret_2": fmt.Sprintf("asm://%s", smSecretPath),
133133
},
134134
},
135135
},

0 commit comments

Comments
 (0)