Skip to content
Snippets Groups Projects
Unverified Commit ab291134 authored by Timo Furrer's avatar Timo Furrer
Browse files

Document HTTP backend and module registry integration

parent 2f922a74
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,34 @@ fmt: ...@@ -97,6 +97,34 @@ fmt:
... ...
``` ```
### GitLab-managed Terraform state backend
This component - by leveraging the [`gitlab-tofu`](src/gitlab-tofu.sh) CLI internally -
automatically configures the
[GitLab-managed Terraform state backend](https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html).
The only thing required is that the Terraform configuration must specify an empty `http` backend block, like this:
```hcl
terraform {
backend "http" {}
}
```
We recommend having a dedicated `backend.tf` file inside your `root_dir`
with the aforementioned block.
### Access to Terraform Module Registry
Similar to automatically configuring the [GitLab-managed Terraform state backend]
the component also sets up credentials to authenticate with the
[Terraform Module Registry](https://docs.gitlab.com/ee/user/packages/terraform_module_registry/)
of the project the pipeline runs in.
It basically sets the `TF_TOKEN_<domain>` variable to the `$CI_JOB_TOKEN`, where `<domain>` is
the GitLab instance domain, for example for GitLab.com this would set `TF_TOKEN_gitlab_com` to
the `$CI_JOB_TOKEN`. However, it'll only do so if the variable is not already provided.
Thus, if you want to authenticate differently or to another Terraform Module Registry,
you may just provide the `TF_TOKEN_<domain>` variable yourself, e.g. via CI/CD variables.
### Opinionated Templates ### Opinionated Templates
This component repository also provides some templates that may often be used, This component repository also provides some templates that may often be used,
......
...@@ -99,6 +99,34 @@ fmt: ...@@ -99,6 +99,34 @@ fmt:
... ...
``` ```
### GitLab-managed Terraform state backend
This component - by leveraging the [`gitlab-tofu`](src/gitlab-tofu.sh) CLI internally -
automatically configures the
[GitLab-managed Terraform state backend](https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html).
The only thing required is that the Terraform configuration must specify an empty `http` backend block, like this:
```hcl
terraform {
backend "http" {}
}
```
We recommend having a dedicated `backend.tf` file inside your `root_dir`
with the aforementioned block.
### Access to Terraform Module Registry
Similar to automatically configuring the [GitLab-managed Terraform state backend]
the component also sets up credentials to authenticate with the
[Terraform Module Registry](https://docs.gitlab.com/ee/user/packages/terraform_module_registry/)
of the project the pipeline runs in.
It basically sets the `TF_TOKEN_<domain>` variable to the `$CI_JOB_TOKEN`, where `<domain>` is
the GitLab instance domain, for example for GitLab.com this would set `TF_TOKEN_gitlab_com` to
the `$CI_JOB_TOKEN`. However, it'll only do so if the variable is not already provided.
Thus, if you want to authenticate differently or to another Terraform Module Registry,
you may just provide the `TF_TOKEN_<domain>` variable yourself, e.g. via CI/CD variables.
### Opinionated Templates ### Opinionated Templates
This component repository also provides some templates that may often be used, This component repository also provides some templates that may often be used,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment