Skip to content

Instantly share code, notes, and snippets.

@dotemacs
Created April 4, 2024 12:58
Show Gist options
  • Save dotemacs/5a2dcd3474d8f5c23b4f26a4ee712168 to your computer and use it in GitHub Desktop.
Save dotemacs/5a2dcd3474d8f5c23b4f26a4ee712168 to your computer and use it in GitHub Desktop.
Encryption configuration, for Unix/Linux shell returns exit code 1

Exit code 1

Following the example for creating the encryption configuration:

https://1-7-0-alpha1.opentofu.pages.dev/docs/language/state/encryption/#configuration

the exit code is always 1.

This can be annoying on a CI, which expects all the commands to have the exit code of 0.

See:

$ read -d '' TF_ENCRYPTION << EOF
> terraform {
>   encryption {
>     key_provider "some_key_provider" "some_name" {
>       # Key provider options here
>     }
>
>     method "some_method" "some_method_name" {
>       # Method options here
>       keys = key_provider.some_key_provider.some_name
>     }
>
>     state {
>       # Encryption/decryption for state data
>       method = method.some_method.some_method_name
>     }
>
>     plan {
>       # Encryption/decryption for plan data
>       method = method.some_method.some_method_name
>     }
>
>     remote_state_data_sources {
>       # See below
>     }
>   }
> }
> EOF
[alex@/tmp]$ echo $?
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment