diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index 62466509..b57e76d5 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -19,12 +19,12 @@ jobs: strategy: fail-fast: false matrix: - tool: [tofu, terraform] + tool: [tofu] # [tofu, terraform] path: - - fail_invalid_resource_type - - fail_data_source_error + # - fail_invalid_resource_type + # - fail_data_source_error - pass_one - - pass_character_limit + # - pass_character_limit - pass_format_diff steps: @@ -50,6 +50,7 @@ jobs: arg_chdir: tests/${{ matrix.path }} arg_command: ${{ github.event.pull_request.merged && 'apply' || 'plan' }} arg_lock: ${{ github.event.pull_request.merged && 'true' || 'false' }} + hide_args: arg_lock tf_tool: ${{ matrix.tool }} tf_version: ~> 1.8.0 diff --git a/README.md b/README.md index f8ffe657..c9e58cf5 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ In order to locally decrypt the TF plan file, use the following command (noting | `comment_pr`
Default: `true` | Boolean flag to add PR comment of TF command output. | | `encrypt_passphrase`
Example: `${{ secrets.KEY }}` | String passphrase to encrypt the TF plan file. | | `fmt_enable`
Default: `true` | Boolean flag to enable TF fmt command and display diff of changes. | +| `hide_args`
Example: [arg_var] | String list of TF arguments to hide from the command input. | | `label_pr`
Default: `true` | Boolean flag to add PR label of TF command to run. | | `plan_parity`
Default: `false` | Boolean flag to compare the TF plan file with a newly-generated one to prevent stale apply. | | `tenv_version`
Example: `v3.1.0` | String version tag of the tenv tool to install and use. | diff --git a/action.js b/action.js index 10043df9..40543f65 100644 --- a/action.js +++ b/action.js @@ -83,7 +83,9 @@ module.exports = async ({ context, core, exec, github }) => { // Function to execute TF commands. const exec_tf = async (input_arguments, input_header, input_header_slice) => { const arguments = input_arguments.filter((arg) => arg); - const header = input_header.filter((arg) => arg); + const header = input_header.filter( + (arg) => arg && !Object.values(JSON.parse(process.env.hide_args)).includes(arg) + ); cli_input = header.concat(arguments.slice(input_header_slice)).join(" "); cli_result = ""; core.setOutput("header", cli_input); diff --git a/action.yml b/action.yml index 573ef191..0bf369b9 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,10 @@ inputs: description: Boolean flag to enable TF fmt command and display diff of changes. required: false default: "true" + hide_args: + description: String list of TF arguments to hide from the command input. + required: false + default: "" label_pr: description: Boolean flag to add PR label of TF command to run. required: false @@ -291,6 +295,7 @@ runs: comment_pr: ${{ inputs.comment_pr }} encrypt_passphrase: ${{ inputs.encrypt_passphrase }} fmt_enable: ${{ inputs.fmt_enable }} + hide_args: ${{ toJSON(inputs.hide_args) }} label_pr: ${{ inputs.label_pr }} plan_parity: ${{ inputs.plan_parity }} tf_tool: ${{ inputs.tf_tool }}