Skip to content

Latest commit

 

History

History
105 lines (83 loc) · 3.94 KB

exported-environment-variables.md

File metadata and controls

105 lines (83 loc) · 3.94 KB

Exported environment variables

Terraform output variables

RMK exports all output Terraform variables with the rmk_ prefix for further use in the Helmfile releases. For example, a Terraform outputs.tf file might look like:

output "rmk_hosted_zone_id" {
  description = "Hosted zone ID"
  value       = aws_route53_zone.hosted_zone.zone_id
}

output "rmk_hosted_zone_ns_record" {
  description = "Nameserver of hosted zone"
  value       = aws_route53_zone.hosted_zone.name_servers[0]
}

RMK converts the output variable keys from lowercase to uppercase and removes the rmk_ prefix. To view the exported variables, run the rmk config view command and check the exported-vars section:

exported-vars:
  terraform-output:
    # ...
    rmk_hosted_zone_id: ZXXXXXXXXXXXXXXXXX
    rmk_hosted_zone_ns_record: ns-1522.awsdns-62.org
    # ...
  env:
    # ...
    HOSTED_ZONE_ID: ZXXXXXXXXXXXXXXXXX
    HOSTED_ZONE_NS_RECORD: ns-1522.awsdns-62.org
    # ...

The variables listed in the env section will be used when running the rmk release ... commands.

Only the string output variables are supported.

Default exported variables

By default, RMK exports the following environment variables to each launch of the rmk release category's commands:

# AWS credentials are automatically generated by RMK during the configuration initialization
AWS_PROFILE=<project_name>-<project_branch>
AWS_CONFIG_FILE=${HOME}/.aws/config_<project_name>-<project_branch>
AWS_SHARED_CREDENTIALS_FILE=${HOME}/.aws/credentials_<project_name>-<project_branch>
# For example:
# AWS_PROFILE=kodjin-develop
# AWS_CONFIG_FILE=${HOME}/.aws/config_kodjin-develop
# AWS_SHARED_CREDENTIALS_FILE=${HOME}/.aws/credentials_kodjin-develop

# GitHub Personal Access Token
GITHUB_TOKEN=<github_personal_access_token>

# The path to the directory of the specific version of hooks required for the inherited upstream project
HELMFILE_<upstream_project_name>_HOOKS_DIR=${PWD}/.PROJECT/inventory/hooks/<hooks_repo_name>-<version>
# For example:
# HELMFILE_DEPS_HOOKS_DIR=${PWD}/.PROJECT/inventory/hooks/helmfile.hooks.infra-v1.18.0

# The path to the directory of the specific version of hooks required for the downstream project
HELMFILE_<downstream_project_name>_HOOKS_DIR=${PWD}/.PROJECT/inventory/hooks/<hooks_repo_name>-<version>
# For example:
# HELMFILE_KODJIN_HOOKS_DIR=${PWD}/.PROJECT/inventory/hooks/helmfile.hooks.infra-v1.18.0

# The paths to the directories of the listed inherited upstream projects in the JSON format.
HELMFILE_<project_name>_PATHS='[{"path":"${PWD}/.PROJECT/dependencies/<upstream_repo_name>-<upstream_repo_version>/helmfile.yaml.gotmpl"}]'
# For example:
# HELMFILE_KODJIN_PATHS=[{"path":"${PWD}/.PROJECT/dependencies/deps.bootstrap.infra-v2.18.0/helmfile.yaml.gotmpl"}]

# The version of the inherited upstream project
HELMFILE_<project_repo_name>_VERSION=vN.N.N
# For example:
# HELMFILE_DEPS_BOOTSTRAP_INFRA_VERSION=v2.18.0

# The configuration RMK name for the current project and environment
NAME=<project_name>-<project_branch>
# For example:
# NAME=kodjin-develop

# The root domain name for target applications in the cluster
ROOT_DOMAIN=<project_name>-<project_branch>.example.com
# For example:
# ROOT_DOMAIN=kodjin-develop.example.com

# The path to the file with the merged private Age keys
SOPS_AGE_KEY_FILE=${HOME}/.rmk/sops-age-keys/<project_name>-sops-age-keys-<short_AWS_account_id>/.keys.txt
# For example:
# SOPS_AGE_KEY_FILE=${HOME}/.rmk/sops-age-keys/kodjin-sops-age-keys-28804/.keys.txt

# The tenant name, which is an equivalent to the project name
TENANT=<project_name>
# For example:
# NAME=kodjin

# The flag that indicates whether the cluster is currently based on K3D. The variable can be used for overriding values in the releases.
K3D_CLUSTER=true

All exported variables and their values of the rmk release command category can be viewed by running all these commands in the debug mode:

rmk --log-level=debug release list