Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenTofu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
components
OpenTofu
Commits
ca2687c2
Unverified
Commit
ca2687c2
authored
7 months ago
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Document state and plan encryption support
Changelog: added
parent
6df8850b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab/README.md.template
+90
-0
90 additions, 0 deletions
.gitlab/README.md.template
README.md
+90
-0
90 additions, 0 deletions
README.md
with
180 additions
and
0 deletions
.gitlab/README.md.template
+
90
−
0
View file @
ca2687c2
...
...
@@ -326,6 +326,96 @@ or `TF_CLI_ARGS_init` (handled by OpenTofu directly) to `-lockfile=readonly`
to prevent any changes to the lockfile during the pipeline job and with
that ensuring that OpenTofu really uses the locked dependencies.
#### State and Plan Encryption
We recommend that you configure the OpenTofu
[State and Plan Encryption](https://opentofu.org/docs/language/state/encryption).
You can easily do this by following the guide on the page linked above.
Here is an example:
**Tofu config at `<root-dir>/encryption.tf`**:
```hcl
variable "passphrase" {
sensitive = true
description = "Passphrase to encrypt and decrypt state and plan"
}
terraform {
encryption {
key_provider "pbkdf2" "this" {
passphrase = var.passphrase
}
method "aes_gcm" "this" {
keys = key_provider.pbkdf2.this
}
state {
method = method.aes_gcm.this
}
plan {
method = method.aes_gcm.this
}
}
}
```
Then you only not to configure a passphrase as CI/CD variable with the name
`TF_VAR_passphrase`.
Everything else will work out of the box.
In case you want to migrate from an unencrypted state and plan you can
temporarily configure your encryption block with `fallback`s, like so:
```hcl
variable "passphrase" {
sensitive = true
description = "Passphrase to ecnrypt and decrypt state and plan"
}
terraform {
encryption {
method "unencrypted" "migrate" {}
key_provider "pbkdf2" "this" {
passphrase = var.passphrase
}
method "aes_gcm" "this" {
keys = key_provider.pbkdf2.this
}
state {
method = method.aes_gcm.this
fallback {
method = method.unencrypted.migrate
}
}
plan {
method = method.aes_gcm.this
fallback {
method = method.unencrypted.migrate
}
}
}
}
```
Then you can run the pipeline one time to migrate and then remove the
`unencrypted` `method` and the `fallback` blocks.
> **Call for Action**:
> If you have a good proposal on how to make state and plan encryption
> easier with this component then let us know in an issue!
### Examples
Here are some example repositories to demonstrate how this component maybe used:
...
...
This diff is collapsed.
Click to expand it.
README.md
+
90
−
0
View file @
ca2687c2
...
...
@@ -401,6 +401,96 @@ or `TF_CLI_ARGS_init` (handled by OpenTofu directly) to `-lockfile=readonly`
to prevent any changes to the lockfile during the pipeline job and with
that ensuring that OpenTofu really uses the locked dependencies.
#### State and Plan Encryption
We recommend that you configure the OpenTofu
[
State and Plan Encryption
](
https://opentofu.org/docs/language/state/encryption
)
.
You can easily do this by following the guide on the page linked above.
Here is an example:
**Tofu config at `<root-dir>/encryption.tf`**
:
```
hcl
variable
"passphrase"
{
sensitive
=
true
description
=
"Passphrase to encrypt and decrypt state and plan"
}
terraform
{
encryption
{
key_provider
"pbkdf2"
"this"
{
passphrase
=
var
.
passphrase
}
method
"aes_gcm"
"this"
{
keys
=
key_provider
.
pbkdf2
.
this
}
state
{
method
=
method
.
aes_gcm
.
this
}
plan
{
method
=
method
.
aes_gcm
.
this
}
}
}
```
Then you only not to configure a passphrase as CI/CD variable with the name
`TF_VAR_passphrase`
.
Everything else will work out of the box.
In case you want to migrate from an unencrypted state and plan you can
temporarily configure your encryption block with
`fallback`
s, like so:
```
hcl
variable
"passphrase"
{
sensitive
=
true
description
=
"Passphrase to ecnrypt and decrypt state and plan"
}
terraform
{
encryption
{
method
"unencrypted"
"migrate"
{}
key_provider
"pbkdf2"
"this"
{
passphrase
=
var
.
passphrase
}
method
"aes_gcm"
"this"
{
keys
=
key_provider
.
pbkdf2
.
this
}
state
{
method
=
method
.
aes_gcm
.
this
fallback
{
method
=
method
.
unencrypted
.
migrate
}
}
plan
{
method
=
method
.
aes_gcm
.
this
fallback
{
method
=
method
.
unencrypted
.
migrate
}
}
}
}
```
Then you can run the pipeline one time to migrate and then remove the
`unencrypted`
`method`
and the
`fallback`
blocks.
> **Call for Action**:
> If you have a good proposal on how to make state and plan encryption
> easier with this component then let us know in an issue!
### Examples
Here are some example repositories to demonstrate how this component maybe used:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment