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
feat(runner): refactor runner + use tenv to install binaries (#319)
* refactor(runner): move network mirror creation into utils
* refactor(runner): move getDiff to utils
* refactor(runner): move clone to FetchRepositoryContent
* feat(runner): use tenv library to install binaries
* fix(runner): correct name for hermitcrab env vars
* refactor(runner): rework exec and init functions
* refactor(runner): split the Exec function
* test(runner): add first E2E test
* test(runner): add tf apply E2E test
* test(runner): add tests for hermitcrab and resources
* test(runner): refactor tests to not be parallel
* test(runner): add cases for tg and bin versions
* test(runner): add error cases
* fix(runner): check error from defered os.Chdir
* chore(deps): run go mod tidy after runner refactor
* docs(runner): update docs for tenv and runner refacto
* docs: fix info callouts
* fix(runner): merge messed with datastore initialization
---------
Co-authored-by: Alan <[email protected]>
cmd.Flags().StringVar(&app.Config.Runner.SSHKnownHostsConfigMapName, "ssh-known-hosts-cm-name", "burrito-ssh-known-hosts", "configmap name to get known hosts file from")
23
23
cmd.Flags().StringVar(&app.Config.Runner.RunnerBinaryPath, "runner-binary-path", "/runner/bin", "binary path where the runner can expect to find terraform or terragrunt binaries")
24
+
cmd.Flags().StringVar(&app.Config.Runner.RepositoryPath, "repository-path", "/runner/repository", "path where the runner fetches the Git repository to work on")
Create a `TerraformLayer` resource in the `burrito-system` namespace, referencing the `TerraformRepository` you just created. For now, the autoApply is set to false, so the layer will only plan the Terraform code and not apply it.
82
+
Create a `TerraformLayer` resource in the `burrito-system` namespace, referencing the `TerraformRepository` you just created. For now, the `autoApply` is set to false, so the layer will only plan the Terraform code and not apply it.
Copy file name to clipboardExpand all lines: docs/operator-manual/architecture.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,9 +86,8 @@ The `TerraformRun` controller also creates and deletes the [Kubernetes leases](h
86
86
87
87
### The runners
88
88
89
-
The runner image implementation heavily relies on Golang libraries provided by Hashicorp such as [`tfexec`](https://github.com/hashicorp/terraform-exec) and [`hc-install`](https://github.com/hashicorp/hc-install) which allows us to dynamically download and use any version of the Terraform binary.
90
-
Thus, we support any existing version of Terraform.
89
+
The runner implementation relies on [`tenv`](https://github.com/tofuutils/tenv), a tool from the community which allows us to dynamically download and use any version of Terraform, Terragrunt or OpenTofu (coming soon). Thus, we support any existing version of Terraform.
91
90
92
-
The runners also support any existing version of [Terragrunt](https://terragrunt.gruntwork.io/).
91
+
If no version constraint is set in the TerraformLayer resource or in the TerraformRepository resource, `tenv` will detect which version of Terraform/Terragrunt/OpenTofu to use by looking at the version constraints in your code.
93
92
94
-
The runner is responsible to update the annotations of the layer it is associated with to store information about what commit was plan/apply and when.
93
+
The runner is responsible to update the annotations of the layer it is associated to to store information about what commit was planned/applied and when.
In this documentation all references to pull requests can be change to merge requests for GitLab. However, the resulting Kubernetes object will still be named `TerraformPullRequest`.
6
+
In this documentation all references to pull requests can be change to merge requests for GitLab. However, the resulting Kubernetes object will still be named `TerraformPullRequest`.
7
7
8
8
## Components
9
9
10
10
### The server
11
11
12
12
!!! info
13
-
For more information about the server, see the [architectural overview](./architecture.md) documentation.
13
+
For more information about the server, see the [architectural overview](./architecture.md) documentation.
14
14
15
15
Upon receiving a Pull Request creation event, the server creates a `TerraformPullRequest` resource.
16
16
@@ -35,7 +35,7 @@ The status of a `TerraformPulLRequest` is defined using the [conditions standard
35
35
-`IsCommentUpToDate`. This condition is used to check if the controller needs to send a comment to a pull request. This is checked by comparing the last discovered commit and the last commit for which a comment was already sent.
Copy file name to clipboardExpand all lines: docs/user-guide/terraform-version.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,20 @@
1
-
# Choose a terraform/terragrunt version
1
+
# Configure a Terraform/Terragrunt/OpenTofu version
2
2
3
-
For now, Burrito doesn't auto-detect the terraform or terragrunt version used in your repository. You have to specify it in the `TerraformRepository` or `TerraformLayer` resource.
3
+
By leveraging [`tenv`](https://github.com/tofuutils/tenv), Burrito auto-detects the Terraform, Terragrunt or OpenTofu version used in your repository, with version constraints set in your code (see [`tenv`'s README](https://github.com/tofuutils/tenv/blob/main/README.md)).
4
4
5
-
## Choose terraform version
5
+
Additionally, you can to specify version constraints in the `TerraformRepository` or `TerraformLayer` resource as described below.
6
6
7
-
Both `TerraformRepository` and `TerraformLayer` expose a `spec.terrafrom.version` map field.
7
+
## Choose Terraform version
8
+
9
+
Both `TerraformRepository` and `TerraformLayer` expose a `spec.terraform.version` map field that support version constraints as described in the [Terraform documentation](https://www.terraform.io/docs/language/expressions/version-constraints.html).
8
10
9
11
If the field is specified for a given `TerraformRepository` it will be applied by default to all `TerraformLayer` linked to it.
10
12
11
13
If the field is specified for a given `TerraformLayer` it will take precedence over the `TerraformRepository` configuration.
12
14
13
15
## Enable Terragrunt
14
16
15
-
You can specify usage of terragrunt as follow:
17
+
You can specify usage of Terragrunt with the `spec.terraform.terragrunt` map as follow:
16
18
17
19
```yaml
18
20
apiVersion: config.terraform.padok.cloud/v1alpha1
@@ -21,7 +23,7 @@ metadata:
21
23
name: random-pets-terragrunt
22
24
spec:
23
25
terraform:
24
-
version: "1.3.1"
26
+
version: "~> 1.3.0"
25
27
terragrunt:
26
28
enabled: true
27
29
version: "0.44.5"
@@ -36,3 +38,7 @@ spec:
36
38
37
39
!!! info
38
40
This configuration can be specified at the `TerraformRepository` level to be enabled by default in each of its layers.
0 commit comments