-
Notifications
You must be signed in to change notification settings - Fork 0
/
sops-test.tf
49 lines (39 loc) · 1.14 KB
/
sops-test.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
terraform {
required_providers {
sops = {
source = "carlpett/sops"
version = "~> 0.5"
}
}
}
data "sops_file" "demo-secret" {
source_file = "app-secrets/demo-secrets.enc.json"
}
output "hello" {
# Access a variable from the map
sensitive = true
value = data.sops_file.demo-secret.data["hello"]
}
output "example-nested-value-1" {
sensitive = true
# Access a variable that is nested via the terraform map of data
value = data.sops_file.demo-secret.data["example_nested.example_key1"]
}
# output "example-nested-value-2" {
# sensitive = true
# # Access a variable that is nested via the terraform map of data
# value = data.sops_file.demo-secret.data["example_nested.example_key2"]
# }
output "nested-json-value-example-2" {
sensitive = true
# Access a variable via the terraform object
value = jsondecode(data.sops_file.demo-secret.raw).example_nested.example_key2
}
output "example-array-value-0" {
sensitive = true
value = jsondecode(data.sops_file.demo-secret.raw).example_array[0]
}
output "example-boolean" {
sensitive = true
value = jsondecode(data.sops_file.demo-secret.raw).example_booleans[0]
}