Skip to content

Commit

Permalink
feat(tft): add GetStringOutputList (#2159)
Browse files Browse the repository at this point in the history
Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
  • Loading branch information
apeabody and bharathkkb committed Feb 16, 2024
1 parent d490065 commit 48810af
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions infra/blueprint-test/pkg/tft/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,21 @@ func getKVFromOutputString(v string) (string, string, error) {
// GetStringOutput returns TF output for a given key as string.
// It fails test if given key does not output a primitive.
func (b *TFBlueprintTest) GetStringOutput(name string) string {
// allow only parallel reads as Terraform plugin cache isn't concurrent safe
rUnlockFn := b.rLockFn()
defer rUnlockFn()
return terraform.Output(b.t, b.GetTFOptions(), name)
}

// GetStringOutputList returns TF output for a given key as list.
// It fails test if given key does not output a primitive.
func (b *TFBlueprintTest) GetStringOutputList(name string) []string {
// allow only parallel reads as Terraform plugin cache isn't concurrent safe
rUnlockFn := b.rLockFn()
defer rUnlockFn()
return terraform.OutputList(b.t, b.GetTFOptions(), name)
}

// GetTFSetupOutputListVal returns TF output from setup for a given key as list.
// It fails test if given key does not output a list type.
func (b *TFBlueprintTest) GetTFSetupOutputListVal(key string) []string {
Expand Down

0 comments on commit 48810af

Please sign in to comment.