Skip to content

fix: duplicate keys #91

fix: duplicate keys

fix: duplicate keys #91

name: Terraform Validate Tests 1.2.0
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
jobs:
terraform_validate:
name: 'TF Validate'
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 25
matrix:
terraform_ver: [~1.2.0] # Job matrix can generate a maximum of 256 jobs per workflow run
sap_solution_scenario: [sap_bw4hana_single_node_install, sap_ecc_hana_single_node_install, sap_ecc_hana_single_node_system_copy_homogeneous_hdb, sap_ecc_ibmdb2_single_node_install, sap_ecc_oracledb_single_node_install, sap_ecc_sapase_single_node_install, sap_ecc_sapmaxdb_single_node_install, sap_hana_single_node_install, sap_nwas_abap_hana_install, sap_nwas_abap_ibmdb2_install, sap_nwas_abap_oracledb_install, sap_nwas_abap_sapase_install, sap_nwas_abap_sapmaxdb_install, sap_nwas_java_ibmdb2_install, sap_nwas_java_sapase_install, sap_s4hana_distributed_install, sap_s4hana_single_node_install, sap_s4hana_single_node_install_maintenance_plan, sap_s4hana_single_node_system_copy_homogeneous_hdb, sap_solman_sapase_single_node_install, sap_solman_saphana_single_node_install]
infrastructure_platform: [aws_ec2_instance, gcp_ce_vm, ibmcloud_vs, ibmcloud_powervs, ibmpowervc, msazure_vm, vmware_vm]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: ${{ matrix.terraform_ver }}
- name: Check if directory empty
id: directory_empty_flag
run: |
# Check directory, add result to empty_string, make visible to other step tasks (use string, not boolean)
if [ -d "$PWD/${{ matrix.sap_solution_scenario }}/${{ matrix.infrastructure_platform }}" ]; then
dir_test=$(ls -lha "$PWD/${{ matrix.sap_solution_scenario }}/${{ matrix.infrastructure_platform }}" | grep main.tf)
if [ -z "${dir_test}" ]; then echo 'null' && exit 0 ; else FLAG="true" && echo "FLAG=$FLAG" >> $GITHUB_ENV ; fi
else
echo 'null' && exit 0
fi
- name: Terraform Init, if directory is not empty
if: ${{ env.FLAG == 'true' }}
id: init
run: |
cd "./${{ matrix.sap_solution_scenario }}/${{ matrix.infrastructure_platform }}"
terraform init
- name: Terraform Validate, if directory is not empty
if: ${{ env.FLAG == 'true' }}
id: validate
run: |
cd "./${{ matrix.sap_solution_scenario }}/${{ matrix.infrastructure_platform }}"
terraform validate -no-color