-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/command: Ensure ephemeral variables are validated accordingly
- Loading branch information
1 parent
4441cbd
commit 16d84a4
Showing
21 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...ata/plan-ephemeral-values-invalid-eph-var-in-non-eph-output/invalid-variable-in-output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "eph" { | ||
ephemeral = true | ||
default = "foo" | ||
} | ||
|
||
output "not-eph" { | ||
value = var.eph | ||
} |
1 change: 1 addition & 0 deletions
1
.../testdata/plan-ephemeral-values-invalid-module-eph-output/.terraform/modules/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"test","Source":"./eph-module","Dir":"eph-module"}]} |
8 changes: 8 additions & 0 deletions
8
...al/command/testdata/plan-ephemeral-values-invalid-module-eph-output/eph-module/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
output "eph" { | ||
ephemeral = true | ||
value = var.eph | ||
} | ||
|
||
output "not-eph" { | ||
value = "foo" | ||
} |
4 changes: 4 additions & 0 deletions
4
.../command/testdata/plan-ephemeral-values-invalid-module-eph-output/eph-module/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "eph" { | ||
type = string | ||
ephemeral = true | ||
} |
9 changes: 9 additions & 0 deletions
9
...command/testdata/plan-ephemeral-values-invalid-module-eph-output/invalid-module-output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module "test" { | ||
source = "./eph-module" | ||
eph = "foo" | ||
} | ||
|
||
output "eph" { | ||
ephemeral = true | ||
value = module.test.not-eph | ||
} |
1 change: 1 addition & 0 deletions
1
...mmand/testdata/plan-ephemeral-values-invalid-module-input/.terraform/modules/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"test","Source":"./eph-module","Dir":"eph-module"}]} |
3 changes: 3 additions & 0 deletions
3
internal/command/testdata/plan-ephemeral-values-invalid-module-input/eph-module/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "eph" { | ||
type = string | ||
} |
10 changes: 10 additions & 0 deletions
10
...l/command/testdata/plan-ephemeral-values-invalid-module-input/variable-in-module-input.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
variable "test-eph" { | ||
type = string | ||
default = "foo" | ||
ephemeral = true | ||
} | ||
|
||
module "test" { | ||
source = "./eph-module" | ||
eph = var.test-eph | ||
} |
1 change: 1 addition & 0 deletions
1
...tdata/plan-ephemeral-values-invalid-module-non-eph-output/.terraform/modules/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"test","Source":"./eph-module","Dir":"eph-module"}]} |
8 changes: 8 additions & 0 deletions
8
...ommand/testdata/plan-ephemeral-values-invalid-module-non-eph-output/eph-module/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
output "eph" { | ||
ephemeral = true | ||
value = var.eph | ||
} | ||
|
||
output "not-eph" { | ||
value = "foo" | ||
} |
4 changes: 4 additions & 0 deletions
4
...mand/testdata/plan-ephemeral-values-invalid-module-non-eph-output/eph-module/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "eph" { | ||
type = string | ||
ephemeral = true | ||
} |
8 changes: 8 additions & 0 deletions
8
...and/testdata/plan-ephemeral-values-invalid-module-non-eph-output/invalid-module-output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module "test" { | ||
source = "./eph-module" | ||
eph = "foo" | ||
} | ||
|
||
output "eph" { | ||
value = module.test.eph | ||
} |
8 changes: 8 additions & 0 deletions
8
...data/plan-ephemeral-values-invalid-noneph-var-in-eph-output/invalid-variable-in-output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "not-eph" { | ||
default = "foo" | ||
} | ||
|
||
output "eph" { | ||
ephemeral = true | ||
value = var.not-eph | ||
} |
1 change: 1 addition & 0 deletions
1
...command/testdata/plan-ephemeral-values-valid-module-input/.terraform/modules/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"test","Source":"./eph-module","Dir":"eph-module"}]} |
4 changes: 4 additions & 0 deletions
4
internal/command/testdata/plan-ephemeral-values-valid-module-input/eph-module/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "eph" { | ||
ephemeral = true | ||
type = string | ||
} |
10 changes: 10 additions & 0 deletions
10
...nal/command/testdata/plan-ephemeral-values-valid-module-input/variable-in-module-input.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
variable "test-eph" { | ||
type = string | ||
default = "foo" | ||
ephemeral = true | ||
} | ||
|
||
module "test" { | ||
source = "./eph-module" | ||
eph = var.test-eph | ||
} |
9 changes: 9 additions & 0 deletions
9
internal/command/testdata/plan-ephemeral-values-valid/variable-in-output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "valid-eph" { | ||
ephemeral = true | ||
default = "foo" | ||
} | ||
|
||
output "valid-eph" { | ||
ephemeral = true | ||
value = var.valid-eph | ||
} |
8 changes: 8 additions & 0 deletions
8
internal/command/testdata/plan-ephemeral-values-valid/variable-in-provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "token" { | ||
ephemeral = true | ||
default = "insecure" | ||
} | ||
|
||
provider "test" { | ||
token = var.token | ||
} |
9 changes: 9 additions & 0 deletions
9
internal/command/testdata/plan-ephemeral-values-variable-validation/variable-validation.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "test" { | ||
ephemeral = true | ||
default = "foo" | ||
|
||
validation { | ||
condition = var.test != "foo" | ||
error_message = "value" | ||
} | ||
} |