-
Notifications
You must be signed in to change notification settings - Fork 0
/
terraform.cue
96 lines (89 loc) · 1.83 KB
/
terraform.cue
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package ddcompose
import (
"path"
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
#Terraform: {
source: dagger.#FS
manifests: dagger.#FS
sops: #SOPS
_sourceDir: "/src"
_manifestsDir: "/manifests"
_build: docker.#Build & {
steps: [
docker.#Pull & {
source: "hashicorp/terraform"
resolveMode: "forcePull"
},
docker.#Copy & {
_source: docker.#Pull & {
source: "mozilla/sops:v3-alpine"
resolveMode: "forcePull"
}
contents: _source.image.rootfs
source: "/usr/local/bin/sops"
dest: "/usr/local/bin/sops"
},
docker.#Run & {
entrypoint: []
command: {
name: "apk"
args: ["add", "--no-cache", "bash"]
}
},
docker.#Copy & {
dest: _sourceDir
contents: source
},
docker.#Copy & {
dest: _manifestsDir
contents: manifests
},
docker.#Run & {
workdir: _sourceDir
mounts: {
(sops & {dest: "/root/.config/sops"}).mounts
"terraform.sh": {
_script: core.#Source & {
path: "."
include: ["terraform.sh"]
}
dest: "/terraform.sh"
contents: _script.output
source: "/terraform.sh"
}
".terraform": {
dest: path.Resolve(workdir, ".terraform")
contents: core.#CacheDir & {
id: ".terraform"
}
}
"tmp": {
dest: "/tmp"
contents: core.#TempDir
}
}
env: {
"TF_VAR_manifests_dir": _manifestsDir
"TF_VAR_temporary_dir": mounts."tmp".dest
}
entrypoint: []
command: name: mounts."terraform.sh".dest
},
]
}
_source: core.#Subdir & {
input: _build.output.rootfs
path: _sourceDir
}
_manifests: core.#Subdir & {
input: _build.output.rootfs
path: _manifestsDir
}
output: {
source: _source.output
manifests: _manifests.output
}
}