mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
* feat(terraformExecute): run init prior to command * Docs & fmt * cleanup * feat(terraformExecute): fetch cli config from vault or jenkins * fix * cleanup * cleanup * Update resources/metadata/terraformExecute.yaml * rename config param from terraformConfigFile to cliConfigFile * rename credential params * cleanup * fix Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
metadata:
|
|
name: terraformExecute
|
|
description: Executes Terraform
|
|
longDescription: |
|
|
This step executes the terraform binary with the given command, and is able to fetch additional variables from vault.
|
|
spec:
|
|
inputs:
|
|
secrets:
|
|
- name: cliConfigFileCredentialsId
|
|
description: Jenkins 'Secret file' credentials ID containing terraform CLI configuration. You can find more details about it in the [Terraform documentation](https://www.terraform.io/docs/cli/config/config-file.html#credentials).
|
|
type: jenkins
|
|
params:
|
|
- name: command
|
|
type: string
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
default: plan
|
|
- name: terraformSecrets
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
type: string
|
|
resourceRef:
|
|
- type: vaultSecretFile
|
|
name: terraformExecuteFileVaultSecret
|
|
default: terraform
|
|
- name: globalOptions
|
|
type: "[]string"
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
- name: additionalArgs
|
|
type: "[]string"
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
- name: init
|
|
type: bool
|
|
descriptions: Executes terraform init prior to the configured command.
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
default: false
|
|
- name: cliConfigFile
|
|
type: string
|
|
description: Path to the terraform CLI configuration file (https://www.terraform.io/docs/cli/config/config-file.html#credentials).
|
|
scope:
|
|
- PARAMETERS
|
|
- STAGES
|
|
- STEPS
|
|
secret: true
|
|
resourceRef:
|
|
- name: cliConfigFileCredentialsId
|
|
type: secret
|
|
- type: vaultSecretFile
|
|
name: cliConfigFileVaultSecretName
|
|
default: terraform
|
|
containers:
|
|
- name: terraform
|
|
image: hashicorp/terraform:0.14.7
|
|
options:
|
|
- name: --entrypoint
|
|
value: ''
|
|
env:
|
|
- name: TF_IN_AUTOMATION
|
|
value: piper
|