From 49a39778f84e1ac56437db2770edcb7c90abe343 Mon Sep 17 00:00:00 2001 From: Erik Jagyugya Date: Thu, 25 Nov 2021 11:15:37 +0100 Subject: [PATCH] Add module Signed-off-by: Erik Jagyugya --- .github/workflows/terraform.yaml | 101 +++++++++--------- .../terraform-azure-psp/examples/complete/t | 0 project_spaces/terraform.tfvars | 37 +++++++ 3 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 modules/terraform-azure-psp/examples/complete/t create mode 100644 project_spaces/terraform.tfvars diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index daae61f..3388ef2 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -3,16 +3,16 @@ name: Terraform # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - workflow_dispatch: + workflow_dispatch: inputs: - username: - description: 'A username passed from the caller workflow' - default: 'john-doe' - required: false + tfvars_file_name: + description: 'A tfvars file passed from the caller workflow' + default: 'terraform.tfvars' + required: true type: string defaults: run: - working-directory: modules/terraform-azure-caf + working-directory: ./modules/terraform-azure-psp/examples/complete # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains the following jobs @@ -29,45 +29,50 @@ jobs: steps: - name: Checkout Source Code uses: actions/checkout@v2 - - name: Install Terraform - uses: hashicorp/setup-terraform@v1 - - name: Terraform fmt - id: fmt - run: terraform fmt -check - - name: Terraform Init - id: init - run: terraform init - - name: Terraform Validate - id: validate - run: terraform validate - - name: Terraform Plan - id: plan - run: terraform plan - terraform-apply: - # The type of runner that the job will run on - runs-on: ubuntu-latest - needs: ["terraform-plan"] - env: - TF_CLI_ARGS: '-no-color' - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} - ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Checkout Source Code - uses: actions/checkout@v2 - - name: Install Terraform - uses: hashicorp/setup-terraform@v1 - - name: Terraform fmt - id: fmt - run: terraform fmt -check - - name: Terraform Init - id: init - run: terraform init - - name: Terraform Validate - id: validate - run: terraform validate - - name: Terraform Plan - id: plan - run: terraform apply \ No newline at end of file + - name: Print the input name to STDOUT + run: cat ${{ env.TFVARS_FILE_PATH }}/${{ inputs.tfvars_file_name }}" + env: + TFVARS_FILE_PATH: ../../../../project_spaces + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v1 + # - name: Terraform fmt + # id: fmt + # run: terraform fmt -check + # - name: Terraform Init + # id: init + # run: terraform init + # - name: Terraform Validate + # id: validate + # run: terraform validate + # - name: Terraform Plan + # id: plan + # run: terraform plan + # terraform-apply: + # # The type of runner that the job will run on + # runs-on: ubuntu-latest + # needs: ["terraform-plan"] + # env: + # TF_CLI_ARGS: '-no-color' + # ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} + # ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} + # ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} + # ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} + # # Steps represent a sequence of tasks that will be executed as part of the job + # steps: + # - name: Checkout Source Code + # uses: actions/checkout@v2 + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v1 + # - name: Terraform fmt + # id: fmt + # run: terraform fmt -check + # - name: Terraform Init + # id: init + # run: terraform init + # - name: Terraform Validate + # id: validate + # run: terraform validate + # - name: Terraform Plan + # id: plan + # run: terraform apply \ No newline at end of file diff --git a/modules/terraform-azure-psp/examples/complete/t b/modules/terraform-azure-psp/examples/complete/t new file mode 100644 index 0000000..e69de29 diff --git a/project_spaces/terraform.tfvars b/project_spaces/terraform.tfvars new file mode 100644 index 0000000..8842171 --- /dev/null +++ b/project_spaces/terraform.tfvars @@ -0,0 +1,37 @@ +# Copyright 2021 Nordcloud Oy or its affiliates. All Rights Reserved. + +project_space_name = "complete-app" + +environment = "test" + +location = "westeurope" + +location_short = "weu" + +network_type = "default" + +peering_type = "hub" + +resource_group_names = ["auxilaryapp"] + +subscription_id = "361c4a51-f554-4e57-8c0f-95d5fcf219c1" + +subscription_name = "sub-lz-example-app-test-001" + +management_group_id = "TestExternal" + +virtual_networks = [ + { + overwrite_peering_name : "", + use_remote_gateways : false, + network_name : "vnet-dev-spoke-001", + network_prefix : "10.250.250.0/24", + network_private_dns_name : "nord.cloud.com", + subnets = [ + { + name : "snet-dev-001", + address_prefix : "10.250.250.0/26" + } + ] + } +]