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

Adding cascading secrets to Deployment settings #475

Merged
merged 1 commit into from
Dec 13, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Improvements
- Added secret support for all fields in DeploymentSettings [#419](https://github.com/pulumi/pulumi-pulumiservice/issues/419)
- Added cascading secrets to Deployment settings [#447](https://github.com/pulumi/pulumi-pulumiservice/issues/447)

### Bug Fixes

Expand Down
10 changes: 8 additions & 2 deletions provider/pkg/provider/deployment_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,12 @@ func toSourceContext(inputMap resource.PropertyMap) *pulumiapi.SourceContext {
}

scInput := getSecretOrObjectValue(inputMap["sourceContext"])
cascadeSecret := inputMap["sourceContext"].IsSecret()
var sc pulumiapi.SourceContext

if scInput["git"].HasValue() {
gitInput := getSecretOrObjectValue(scInput["git"])
cascadeSecret = cascadeSecret || scInput["git"].IsSecret()
var g pulumiapi.SourceContextGit

if gitInput["repoUrl"].HasValue() {
Expand All @@ -377,6 +379,7 @@ func toSourceContext(inputMap resource.PropertyMap) *pulumiapi.SourceContext {

if gitInput["gitAuth"].HasValue() {
authInput := getSecretOrObjectValue(gitInput["gitAuth"])
cascadeSecret = cascadeSecret || gitInput["gitAuth"].IsSecret()
var a pulumiapi.GitAuthConfig

if authInput["sshAuth"].HasValue() {
Expand All @@ -401,12 +404,13 @@ func toSourceContext(inputMap resource.PropertyMap) *pulumiapi.SourceContext {

if authInput["basicAuth"].HasValue() {
basicInput := getSecretOrObjectValue(authInput["basicAuth"])
cascadeSecret = cascadeSecret || authInput["basicAuth"].IsSecret()
var b pulumiapi.BasicAuth

if basicInput["username"].HasValue() {
b.UserName = pulumiapi.SecretValue{
Value: getSecretOrStringValue(basicInput["username"]),
Secret: false,
Secret: cascadeSecret || basicInput["username"].IsSecret(),
}
}
if basicInput["password"].HasValue() || basicInput["passwordCipher"].HasValue() {
Expand Down Expand Up @@ -434,15 +438,17 @@ func toOperationContext(inputMap resource.PropertyMap) *pulumiapi.OperationConte
}

ocInput := getSecretOrObjectValue(inputMap["operationContext"])
cascadeSecret := inputMap["operationContext"].IsSecret()
var oc pulumiapi.OperationContext

if ocInput["environmentVariables"].HasValue() {
ev := map[string]pulumiapi.SecretValue{}
evInput := getSecretOrObjectValue(ocInput["environmentVariables"])
cascadeSecret = cascadeSecret || ocInput["environmentVariables"].IsSecret()

for k, v := range evInput {
value := getSecretOrStringValue(v)
ev[string(k)] = pulumiapi.SecretValue{Secret: v.IsSecret(), Value: value}
ev[string(k)] = pulumiapi.SecretValue{Secret: v.IsSecret() || cascadeSecret, Value: value}
}

oc.EnvironmentVariables = ev
Expand Down
Loading