Skip to content

Commit

Permalink
Fix panic when environment uses computed values
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyeh committed Sep 23, 2024
1 parent 94db6e3 commit 8195520
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

### Bug Fixes

- Fix panic when using computed values in environment definition [#411](https://github.com/pulumi/pulumi-pulumiservice/issues/411)

### Miscellaneous
10 changes: 7 additions & 3 deletions provider/pkg/provider/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,14 @@ func (st *PulumiServiceEnvironmentResource) Check(req *pulumirpc.CheckRequest) (
}
}

yamlBytes, err := getBytesFromAsset(inputMap["yaml"].AssetValue())
if err != nil {
return nil, err
yamlBytes := []byte{}
if inputMap["yaml"].IsAsset() {
yamlBytes, err = getBytesFromAsset(inputMap["yaml"].AssetValue())
if err != nil {
return nil, err
}
}

stringYaml := string(yamlBytes)
trimmedYaml := strings.TrimSpace(stringYaml)
inputMap["yaml"] = resource.MakeSecret(resource.NewStringProperty(trimmedYaml))
Expand Down

0 comments on commit 8195520

Please sign in to comment.