You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 19, 2021. It is now read-only.
**NOTE:** When adding a provider from a non-hashicorp source, use a `source` field, as follows
33
32
(_the `source` field is only valid for terraform 13+ and is not emitted when using 12_):
34
33
@@ -64,7 +63,7 @@ Build and publish the package to PYPI:
64
63
65
64
## Configuration
66
65
67
-
A project is configured through a worker config, a yaml file that specifies the definitions, inputs, outputs, providers and all other necessary configuration. The worker config is what specifies how state is shared among your definitions. The config support jinja templating that can be used to conditionally pass state or pass in env variables through the command line via the `--config-var` option.
66
+
A project is configured through a worker config, a yaml, json, or hcl2 file that specifies the definitions, inputs, outputs, providers and all other necessary configuration. The worker config is what specifies how state is shared among your definitions. The config support jinja templating that can be used to conditionally pass state or pass in env variables through the command line via the `--config-var` option.
68
67
69
68
*./worker.yaml*
70
69
```yaml
@@ -91,6 +90,68 @@ terraform:
91
90
subnet: network.outputs.subnet_id
92
91
```
93
92
93
+
```json
94
+
{
95
+
"terraform": {
96
+
"providers": {
97
+
"aws": {
98
+
"vars": {
99
+
"region": "{{ aws_region }}",
100
+
"version": "~> 2.61"
101
+
}
102
+
}
103
+
},
104
+
"terraform_vars": {
105
+
"region": "{{ aws_region }}",
106
+
"environment": "dev"
107
+
},
108
+
"definitions": {
109
+
"network": {
110
+
"path": "/definitions/aws/network-existing"
111
+
},
112
+
"database": {
113
+
"path": "/definitions/aws/rds",
114
+
"remote_vars": {
115
+
"subnet": "network.outputs.subnet_id"
116
+
}
117
+
}
118
+
}
119
+
}
120
+
}
121
+
```
122
+
123
+
```hcl
124
+
terraform {
125
+
providers {
126
+
aws = {
127
+
vars = {
128
+
region = "{{ aws_region }}"
129
+
version = "2.63.0"
130
+
}
131
+
}
132
+
}
133
+
134
+
terraform_vars {
135
+
environment = "dev"
136
+
region = "{{ aws_region }}"
137
+
}
138
+
139
+
definitions {
140
+
network = {
141
+
path = "/definitions/aws/network-existing"
142
+
}
143
+
144
+
database = {
145
+
path = "/definitions/aws/rds"
146
+
147
+
remote_vars = {
148
+
subnet = "network.outputs.subnet_id"
149
+
}
150
+
}
151
+
}
152
+
}
153
+
```
154
+
94
155
In this config, the worker manages two separate terraform modules, a `network` and a `database` definition, and shares an output from the network definition with the database definition. This is made available inside of the `database` definition through the `local.subnet` value.
95
156
96
157
`aws_region` is substituted at runtime for the value of `--aws-region` passed through the command line.
@@ -111,3 +172,16 @@ In order to troubleshoot this definition, you would cd /tmp/tmpew44uopp/definiti
111
172
## Background
112
173
113
174
The terraform worker was a weekend project to run terraform against a series of definitions (modules). The idea was the configuration vars, provider configuration, remote state, and variables from remote state would all be dynamically generated. The purpose was for building kubernetes deployments, and allowing all of the configuration information to be stored as either yamnl files in github, or have the worker configuration generated by an API which stored all of the deployment configurations in a database.
175
+
176
+
## Documentation
177
+
178
+
Documentation uses the [Sphinx](https://www.sphinx-doc.org/en/master/index.html) documentation fromework.
179
+
180
+
To build HTML documentation:
181
+
182
+
```bash
183
+
% cd docs
184
+
% make clean && make html
185
+
```
186
+
187
+
The documentation can be viewed locally by open `./docs/build/index.html` in a browser.
0 commit comments