Terraform actions for pipelines.
pipe-terraform [GLOBAL FLAGS] [COMMAND] [FLAGS]
CLI
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$LOG_LEVEL | Define the log level for the application. | stringenum("panic", "fatal", "warn", "info", "debug", "trace") | "info" |
$ENV_FILE | Environment files to inject. | string[] |
pipe-terraform installpipe-terraform lintpipe-terraform planpipe-terraform applypipe-terraform publishpipe-terraform installInstall terraform project.
pipe-terraform install [FLAGS]
Config
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOG_LEVEL$TF_LOG_LEVEL$TF_LOG | Terraform log level. | stringformat(enum("trace", "debug", "info", "warn", "error")) |
Injected Variables
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CI_API_URL$TF_VAR_CI_API_V4_URL$CI_API_V4_URL | Injected CI api-url variable to the deployment. | string | |
$TERRAFORM_CI_PROJECT_ID$TF_VAR_CI_PROJECT_ID$CI_PROJECT_ID | Injected CI project-id variable to the deployment. | string |
Install
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_INSTALL_RECONFIGURE$TF_INSTALL_RECONFIGURE | Reconfigure flag for terraform init. | bool | false |
$TERRAFORM_INSTALL_USE_LOCKFILE$TF_INSTALL_USE_LOCKFILE | Use lockfile for terraform init. | bool | false |
$TERRAFORM_INSTALL_ARGS$TF_INSTALL_ARGS | Additional arguments for terraform init. | string |
Login
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOGIN | Terraform registries to login to. | stringformat(yaml([]struct{ uri: string, token: string })) |
Project
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CWD$TF_ROOT | Working directory for terraform commands. | string | "." |
State
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_STATE_TYPE$TF_STATE_TYPE | Terraform state type. | stringformat(enum("gitlab-http")) | |
$TERRAFORM_STATE_NAME$TF_STATE_NAME | Terraform state name. | string | "default" |
$TERRAFORM_STATE_STRICT$TF_STATE_STRICT | Fail when no Terraform state type is configured. | bool | false |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_ADDRESS$TF_HTTP_ADDRESS$TF_ADDRESS | HTTP address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_ADDRESS$TF_HTTP_LOCK_ADDRESS | HTTP lock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_METHOD$TF_HTTP_LOCK_METHOD | HTTP lock method for the GitLab HTTP state backend. | string | "POST" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_ADDRESS$TF_HTTP_UNLOCK_ADDRESS | HTTP unlock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_METHOD$TF_HTTP_UNLOCK_METHOD | HTTP unlock method for the GitLab HTTP state backend. | string | "DELETE" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_USERNAME$TF_HTTP_USERNAME$TF_USERNAME | HTTP username for the GitLab HTTP state backend. | string | "gitlab-ci-token" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_PASSWORD$TF_HTTP_PASSWORD$TF_PASSWORD$CI_JOB_TOKEN | HTTP password for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_RETRY_WAIT_MIN$TF_HTTP_RETRY_WAIT_MIN | Minimum time to wait between HTTP retries for the GitLab HTTP state backend, in seconds. | string | "5" |
pipe-terraform lintLint terraform project with terraform.
pipe-terraform lint [FLAGS]
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOG_LEVEL$TF_LOG_LEVEL$TF_LOG | Terraform log level. | stringformat(enum("trace", "debug", "info", "warn", "error")) |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CI_API_URL$TF_VAR_CI_API_V4_URL$CI_API_V4_URL | Injected CI api-url variable to the deployment. | string | |
$TERRAFORM_CI_PROJECT_ID$TF_VAR_CI_PROJECT_ID$CI_PROJECT_ID | Injected CI project-id variable to the deployment. | string |
Lint
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LINT_FORMAT_CHECK_ENABLE$TF_LINT_FMT_CHECK_ENABLE | Enable terraform fmt. | bool | true |
$TERRAFORM_LINT_FORMAT_CHECK_ARGS$TF_LINT_FMT_CHECK_ARGS | Additional arguments for terraform fmt. | string | |
$TERRAFORM_LINT_VALIDATE_ENABLE$TF_LINT_VALIDATE_ENABLE | Enable terraform validate. | bool | true |
$TERRAFORM_LINT_VALIDATE_ARGS$TF_LINT_VALIDATE_ARGS | Additional arguments for terraform validate. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CWD$TF_ROOT | Working directory for terraform commands. | string | "." |
pipe-terraform planPlan terraform project.
pipe-terraform plan [FLAGS]
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOG_LEVEL$TF_LOG_LEVEL$TF_LOG | Terraform log level. | stringformat(enum("trace", "debug", "info", "warn", "error")) |
GitLab Merge Request Report
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$GITLAB_MR_REPORT_ENABLED | Enable GitLab merge request report note on the given merge request. | bool | false |
$GL_PIPES_TOKEN | GitLab API token for merge request report notes. | string | |
$CI_API_V4_URL | GitLab API URL for merge request report notes. | string | |
$CI_PROJECT_ID | GitLab project id for merge request report notes. | string | |
$CI_MERGE_REQUEST_IID | GitLab merge request iid for merge request report notes. | int | 0 |
$GITLAB_MR_REPORT_IDENTIFIER | Hidden marker identifier for merge request report notes. Defaults to the job name combined with the stack or state under report. | string | |
$CI_COMMIT_BRANCH | Branch of the pipeline, whose merge requests merged into the commit are reported on when it is the default branch. | string | |
$CI_DEFAULT_BRANCH | Default branch of the project, the only branch whose pipelines report on the merge requests merged into the commit. | string | |
$GITLAB_MR_REPORT_DEPLOY_JOB | Name of the job in the pipeline that applies the plan, which the plan report on the merge requests merged into the commit links to run. Links the pipeline when empty or not found. | string | |
$GITLAB_MR_REPORT_PLAN_JOB | Name of the job in the pipeline that planned what is applied, which the deploy report on the merge requests merged into the commit links to. Links the pipeline when empty or not found. | string |
GitLab Pipeline
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$CI_JOB_NAME | GitLab CI job name to include in the plan report metadata. | string | |
$CI_JOB_URL | GitLab CI job URL to include in the plan report metadata. | string | |
$CI_PIPELINE_ID | GitLab CI pipeline id to include in the plan report metadata. | string | |
$CI_PIPELINE_URL | GitLab CI pipeline URL to include in the plan report metadata. | string | |
$CI_COMMIT_SHA | Git commit sha to include in the plan report metadata. | string | |
$CI_COMMIT_SHORT_SHA | Short git commit sha to include in the plan report metadata. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CI_API_URL$TF_VAR_CI_API_V4_URL$CI_API_V4_URL | Injected CI api-url variable to the deployment. | string | |
$TERRAFORM_CI_PROJECT_ID$TF_VAR_CI_PROJECT_ID$CI_PROJECT_ID | Injected CI project-id variable to the deployment. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOGIN | Terraform registries to login to. | stringformat(yaml([]struct{ uri: string, token: string })) |
Plan
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_PLAN_OUTPUT$TF_PLAN_CACHE$TF_APPLY_OUTPUT$TF_PLAN_OUTPUT | Output file for terraform plan. | string | "plan" |
$TERRAFORM_PLAN_ARGS$TF_PLAN_ARGS | Additional arguments for terraform plan. | string | |
$TERRAFORM_PLAN_PREVIEW_FOR_MERGE_REQUESTS$TF_PLAN_PREVIEW_FOR_MRS | Run merge request terraform plans as previews without state locking. | bool | true |
$TERRAFORM_PLAN_PIPELINE_SOURCE$CI_PIPELINE_SOURCE | GitLab CI pipeline source used to detect merge request pipelines. | string | |
$TERRAFORM_PLAN_SUMMARY_OUTPUT$TERRAFORM_SUMMARY_OUTPUT | Output file for terraform plan summary. Leave empty to skip summary generation. | string | "terraform-summary.json" |
Plan Report
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$PLAN_REPORT_LOG_ENABLED | Write the plan report to the job log. | bool | true |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CWD$TF_ROOT | Working directory for terraform commands. | string | "." |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_STATE_TYPE$TF_STATE_TYPE | Terraform state type. | stringformat(enum("gitlab-http")) | |
$TERRAFORM_STATE_NAME$TF_STATE_NAME | Terraform state name. | string | "default" |
$TERRAFORM_STATE_STRICT$TF_STATE_STRICT | Fail when no Terraform state type is configured. | bool | false |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_ADDRESS$TF_HTTP_ADDRESS$TF_ADDRESS | HTTP address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_ADDRESS$TF_HTTP_LOCK_ADDRESS | HTTP lock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_METHOD$TF_HTTP_LOCK_METHOD | HTTP lock method for the GitLab HTTP state backend. | string | "POST" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_ADDRESS$TF_HTTP_UNLOCK_ADDRESS | HTTP unlock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_METHOD$TF_HTTP_UNLOCK_METHOD | HTTP unlock method for the GitLab HTTP state backend. | string | "DELETE" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_USERNAME$TF_HTTP_USERNAME$TF_USERNAME | HTTP username for the GitLab HTTP state backend. | string | "gitlab-ci-token" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_PASSWORD$TF_HTTP_PASSWORD$TF_PASSWORD$CI_JOB_TOKEN | HTTP password for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_RETRY_WAIT_MIN$TF_HTTP_RETRY_WAIT_MIN | Minimum time to wait between HTTP retries for the GitLab HTTP state backend, in seconds. | string | "5" |
pipe-terraform applyApply terraform project.
pipe-terraform apply [FLAGS]
Apply
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_APPLY_OUTPUT$TF_PLAN_CACHE$TF_APPLY_OUTPUT$TF_PLAN_OUTPUT | Output file for terraform apply. | string | "plan" |
$TERRAFORM_APPLY_ARGS$TF_APPLY_ARGS | Additional arguments for terraform apply. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOG_LEVEL$TF_LOG_LEVEL$TF_LOG | Terraform log level. | stringformat(enum("trace", "debug", "info", "warn", "error")) |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$GITLAB_MR_REPORT_ENABLED | Enable GitLab merge request report note on the given merge request. | bool | false |
$GL_PIPES_TOKEN | GitLab API token for merge request report notes. | string | |
$CI_API_V4_URL | GitLab API URL for merge request report notes. | string | |
$CI_PROJECT_ID | GitLab project id for merge request report notes. | string | |
$CI_MERGE_REQUEST_IID | GitLab merge request iid for merge request report notes. | int | 0 |
$GITLAB_MR_REPORT_IDENTIFIER | Hidden marker identifier for merge request report notes. Defaults to the job name combined with the stack or state under report. | string | |
$CI_COMMIT_BRANCH | Branch of the pipeline, whose merge requests merged into the commit are reported on when it is the default branch. | string | |
$CI_DEFAULT_BRANCH | Default branch of the project, the only branch whose pipelines report on the merge requests merged into the commit. | string | |
$GITLAB_MR_REPORT_DEPLOY_JOB | Name of the job in the pipeline that applies the plan, which the plan report on the merge requests merged into the commit links to run. Links the pipeline when empty or not found. | string | |
$GITLAB_MR_REPORT_PLAN_JOB | Name of the job in the pipeline that planned what is applied, which the deploy report on the merge requests merged into the commit links to. Links the pipeline when empty or not found. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$CI_JOB_NAME | GitLab CI job name to include in the plan report metadata. | string | |
$CI_JOB_URL | GitLab CI job URL to include in the plan report metadata. | string | |
$CI_PIPELINE_ID | GitLab CI pipeline id to include in the plan report metadata. | string | |
$CI_PIPELINE_URL | GitLab CI pipeline URL to include in the plan report metadata. | string | |
$CI_COMMIT_SHA | Git commit sha to include in the plan report metadata. | string | |
$CI_COMMIT_SHORT_SHA | Short git commit sha to include in the plan report metadata. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CI_API_URL$TF_VAR_CI_API_V4_URL$CI_API_V4_URL | Injected CI api-url variable to the deployment. | string | |
$TERRAFORM_CI_PROJECT_ID$TF_VAR_CI_PROJECT_ID$CI_PROJECT_ID | Injected CI project-id variable to the deployment. | string |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_LOGIN | Terraform registries to login to. | stringformat(yaml([]struct{ uri: string, token: string })) |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_CWD$TF_ROOT | Working directory for terraform commands. | string | "." |
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_STATE_TYPE$TF_STATE_TYPE | Terraform state type. | stringformat(enum("gitlab-http")) | |
$TERRAFORM_STATE_NAME$TF_STATE_NAME | Terraform state name. | string | "default" |
$TERRAFORM_STATE_STRICT$TF_STATE_STRICT | Fail when no Terraform state type is configured. | bool | false |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_ADDRESS$TF_HTTP_ADDRESS$TF_ADDRESS | HTTP address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_ADDRESS$TF_HTTP_LOCK_ADDRESS | HTTP lock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_LOCK_METHOD$TF_HTTP_LOCK_METHOD | HTTP lock method for the GitLab HTTP state backend. | string | "POST" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_ADDRESS$TF_HTTP_UNLOCK_ADDRESS | HTTP unlock address for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_UNLOCK_METHOD$TF_HTTP_UNLOCK_METHOD | HTTP unlock method for the GitLab HTTP state backend. | string | "DELETE" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_USERNAME$TF_HTTP_USERNAME$TF_USERNAME | HTTP username for the GitLab HTTP state backend. | string | "gitlab-ci-token" |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_PASSWORD$TF_HTTP_PASSWORD$TF_PASSWORD$CI_JOB_TOKEN | HTTP password for the GitLab HTTP state backend. | string | |
$TERRAFORM_STATE_GITLAB_HTTP_HTTP_RETRY_WAIT_MIN$TF_HTTP_RETRY_WAIT_MIN | Minimum time to wait between HTTP retries for the GitLab HTTP state backend, in seconds. | string | "5" |
pipe-terraform publishPublish terraform project.
pipe-terraform publish [FLAGS]
Module
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_PUBLISH_MODULE_NAME$TF_MODULE_NAME$CI_PROJECT_NAME* | Name for the module that will be published. | string | |
$TERRAFORM_PUBLISH_MODULE_TAGS$TF_MODULE_TAGS$CI_COMMIT_TAG | Versions for the module to be published. | string[] | |
$TERRAFORM_PUBLISH_MODULE_CWD$TF_MODULE_CWD$TF_ROOT | Directory for the module that will be published. | string | "." |
$TERRAFORM_PUBLISH_MODULE_SYSTEM$TF_MODULE_SYSTEM | Module system for the module that will be published. | string | "local" |
* required
Registry
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_PUBLISH_REGISTRY_NAME$TF_MODULE_REGISTRY | Registry of the module that will be published. | stringformat(enum("gitlab")) | "gitlab" |
Registry - GitLab
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TERRAFORM_PUBLISH_REGISTRY_GITLAB_API_URL$CI_API_V4_URL | GitLab API URL for the publish call. | string | |
$TERRAFORM_PUBLISH_REGISTRY_GITLAB_PROJECT_ID$CI_PROJECT_ID | GitLab project id for the publish call. | string | |
$TERRAFORM_PUBLISH_REGISTRY_GITLAB_TOKEN$CI_JOB_TOKEN | GitLab API token for the publish call. | string |
Tags From Environment
| Flag / Environment | Description | Type | Default |
|---|---|---|---|
$TAGS_FROM_ENVIRONMENT | Environment variables to read tags from, where a name ending in "*" reads every variable under that prefix. An unset or empty variable is skipped. | string[] |
Content type
Image
Digest
sha256:149116a84…
Size
59.2 MB
Last updated
31 minutes ago
docker pull cenk1cenk2/pipe-terraform