Skip to content

Commit

Permalink
fix(template): runtime env secrets with incorrect indentation (#5635)
Browse files Browse the repository at this point in the history
Fixes #5630 


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
  • Loading branch information
CaptainCarpensir authored Jan 24, 2024
1 parent 7509c02 commit a72c893
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
41 changes: 37 additions & 4 deletions internal/pkg/deploy/cloudformation/stack/transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,16 +854,33 @@ func convertMountPoints(input map[string]*manifest.Volume) []*template.MountPoin
if len(input) == 0 {
return nil
}

// Sort by names for consistent testing
var names []string
for name := range input {
names = append(names, name)
}
sort.Strings(names)

var output []*template.MountPoint
for name, volume := range input {
for _, name := range names {
volume := input[name]
output = append(output, convertMountPoint(aws.String(name), volume.ContainerPath, volume.ReadOnly))
}
return output
}

func convertEFSPermissions(input map[string]*manifest.Volume) []*template.EFSPermission {
// Sort by names for consistent testing
var names []string
for name := range input {
names = append(names, name)
}
sort.Strings(names)

var output []*template.EFSPermission
for _, volume := range input {
for _, name := range names {
volume := input[name]
// If there's no EFS configuration, we don't need to generate any permissions.
if volume.EmptyVolume() {
continue
Expand Down Expand Up @@ -893,8 +910,16 @@ func convertEFSPermissions(input map[string]*manifest.Volume) []*template.EFSPer
}

func convertManagedFSInfo(wlName *string, input map[string]*manifest.Volume) *template.ManagedVolumeCreationInfo {
// Sort by names for consistent testing
var names []string
for name := range input {
names = append(names, name)
}
sort.Strings(names)

var output *template.ManagedVolumeCreationInfo
for name, volume := range input {
for _, name := range names {
volume := input[name]
if volume.EmptyVolume() || !volume.EFS.UseManagedFS() {
continue
}
Expand Down Expand Up @@ -923,8 +948,16 @@ func getRandomUIDGID(name *string) uint32 {
}

func convertVolumes(input map[string]*manifest.Volume) []*template.Volume {
// Sort by names for consistent testing
var names []string
for name := range input {
names = append(names, name)
}
sort.Strings(names)

var output []*template.Volume
for name, volume := range input {
for _, name := range names {
volume := input[name]
// Volumes can contain either:
// a) an EFS configuration, which must be valid
// b) no EFS configuration, in which case the volume is created using task scratch storage in order to share
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ Resources:
{{- end}}
{{- if .NestedStack}}{{$stackName := .NestedStack.StackName}}
{{- range $secret := .NestedStack.SecretOutputs}}
- Name: {{toSnakeCase $secret}}
Value:
Fn::GetAtt: [{{$stackName}}, Outputs.{{$secret}}]
- Name: {{toSnakeCase $secret}}
Value:
Fn::GetAtt: [{{$stackName}}, Outputs.{{$secret}}]
{{- end}}
{{- end}}
RuntimeEnvironmentVariables:
Expand Down

0 comments on commit a72c893

Please sign in to comment.