Skip to content

Commit

Permalink
Add backend-config option (#28)
Browse files Browse the repository at this point in the history
* add backend-config option

* style fix

* build

* remove reconfigure arg

* update logic

Co-authored-by: Ruben Laban <5331085+tun0@users.noreply.github.com>

* build

Co-authored-by: Ruben Laban <5331085+tun0@users.noreply.github.com>
  • Loading branch information
drsherluck and tun0 authored Aug 5, 2022
1 parent 2a7764f commit 216c10c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
google_credentials:
required: true
description: Google credentials
terraform_backend:
required: false
description: Location of a terraform backend configuration file
terraform_directory:
required: false
description: Location of terraform manifests
Expand Down
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12651,6 +12651,7 @@ async function terraform(terraformDirectory, args) {
}

(async () => {
const terraformBackend = core.getInput('terraform_backend');
let terraformDoApply = core.getBooleanInput('terraform_do_apply');
let terraformDoDestroy = core.getBooleanInput('terraform_do_destroy');
const terraformDirectory = core.getInput('terraform_directory');
Expand Down Expand Up @@ -12716,7 +12717,8 @@ async function terraform(terraformDirectory, args) {
}

core.startGroup('Run terraform init');
const tfi = await terraform(terraformDirectory, ['init']);
let tfi_args = terraformBackend ? ['-backend-config=' + terraformBackend] : [];
const tfi = await terraform(terraformDirectory, ['init'].concat(tfi_args));
core.endGroup();
if (tfi.status > 0) {
tf_init = status_failed;
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function terraform(terraformDirectory, args) {
}

(async () => {
const terraformBackend = core.getInput('terraform_backend');
let terraformDoApply = core.getBooleanInput('terraform_do_apply');
let terraformDoDestroy = core.getBooleanInput('terraform_do_destroy');
const terraformDirectory = core.getInput('terraform_directory');
Expand Down Expand Up @@ -101,7 +102,8 @@ async function terraform(terraformDirectory, args) {
}

core.startGroup('Run terraform init');
const tfi = await terraform(terraformDirectory, ['init']);
let tfi_args = terraformBackend ? ['-backend-config=' + terraformBackend] : [];
const tfi = await terraform(terraformDirectory, ['init'].concat(tfi_args));
core.endGroup();
if (tfi.status > 0) {
tf_init = status_failed;
Expand Down

0 comments on commit 216c10c

Please sign in to comment.