From 91dfff60112db7a8308d583616d9ae7fda6996a8 Mon Sep 17 00:00:00 2001 From: mamrajyadav Date: Fri, 12 Jan 2024 23:22:09 +0530 Subject: [PATCH] fix: add attributes and latest versions --- .deepsource.toml | 4 + .github/dependabot.yml | 65 +++++- .github/workflows/auto_assignee.yml | 14 ++ .github/workflows/automerge.yml | 12 + .github/workflows/changelog.yml | 6 +- .github/workflows/readme.yml | 11 +- .github/workflows/semantic-releaser.yml | 30 --- .github/workflows/static-checks.yml | 74 ------ .github/workflows/tf-checks.yml | 21 ++ .github/workflows/tflint.yml | 11 + .github/workflows/tfsec.yml | 4 +- README.yaml | 68 +++--- .../point-to-site-with-ad/example.tf | 34 +-- _example/point-to-site-with-ad/output.tf | 9 + _example/point-to-site-with-ad/versions.tf | 13 ++ .../point-to-site-with-certificate/example.tf | 32 +-- .../point-to-site-with-certificate}/output.tf | 2 +- .../versions.tf | 13 ++ .../site-to-site/example.tf | 28 +-- {example => _example}/site-to-site/output.tf | 7 +- _example/site-to-site/versions.tf | 13 ++ _test/vpn_gateway_test.go | 33 --- .../point-to-site-with-certificate/output.tf | 5 - main.tf | 91 +++++--- output.tf | 19 +- variables.tf | 220 +++++++++++------- versions.tf | 8 +- 27 files changed, 478 insertions(+), 369 deletions(-) create mode 100644 .deepsource.toml create mode 100644 .github/workflows/auto_assignee.yml create mode 100644 .github/workflows/automerge.yml delete mode 100644 .github/workflows/semantic-releaser.yml delete mode 100644 .github/workflows/static-checks.yml create mode 100644 .github/workflows/tf-checks.yml create mode 100644 .github/workflows/tflint.yml rename example/point-to-site-with-ad/main.tf => _example/point-to-site-with-ad/example.tf (81%) create mode 100644 _example/point-to-site-with-ad/output.tf create mode 100644 _example/point-to-site-with-ad/versions.tf rename example/point-to-site-with-certificate/main.tf => _example/point-to-site-with-certificate/example.tf (87%) rename {example/point-to-site-with-ad => _example/point-to-site-with-certificate}/output.tf (56%) create mode 100644 _example/point-to-site-with-certificate/versions.tf rename example/site-to-site/main.tf => _example/site-to-site/example.tf (86%) rename {example => _example}/site-to-site/output.tf (60%) create mode 100644 _example/site-to-site/versions.tf delete mode 100644 _test/vpn_gateway_test.go delete mode 100644 example/point-to-site-with-certificate/output.tf diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..18b001a --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,4 @@ +version = 1 + +[[analyzers]] +name = "terraform" \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 812c152..a94273e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,19 +5,78 @@ version: 2 updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 3 + assignees: + - "clouddrove-ci" + reviewers: + - "approvers" + - package-ecosystem: "terraform" # See documentation for possible values directory: "/" # Location of package manifests schedule: interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + + - package-ecosystem: "terraform" # See documentation for possible values + directory: "/_example/complete" # Location of package manifests + schedule: + interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + - package-ecosystem: "terraform" # See documentation for possible values - directory: "example/point-to-site-with-ad" # Location of package manifests + directory: "/_example/point-to-site-with-certificate" # Location of package manifests schedule: interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + - package-ecosystem: "terraform" # See documentation for possible values - directory: "example/point-to-site-with-certificate" # Location of package manifests + directory: "/_example/point-to-site-with-ad" # Location of package manifests schedule: interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 + - package-ecosystem: "terraform" # See documentation for possible values - directory: "example/site-to-site" # Location of package manifests + directory: "/_example/site-to-site" # Location of package manifests schedule: interval: "weekly" + # Add assignees + assignees: + - "clouddrove-ci" + # Add reviewer + reviewers: + - "approvers" + # Allow up to 3 open pull requests for pip dependencies + open-pull-requests-limit: 3 diff --git a/.github/workflows/auto_assignee.yml b/.github/workflows/auto_assignee.yml new file mode 100644 index 0000000..d10f4a1 --- /dev/null +++ b/.github/workflows/auto_assignee.yml @@ -0,0 +1,14 @@ +name: Auto Assign PRs + +on: + pull_request: + types: [opened, reopened] + + workflow_dispatch: +jobs: + assignee: + uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.0.10 + secrets: + GITHUB: ${{ secrets.GITHUB }} + with: + assignees: 'clouddrove-ci' diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..728924c --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,12 @@ +--- +name: Auto merge +on: + pull_request: +jobs: + auto-merge: + uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@1.0.10 + secrets: + GITHUB: ${{ secrets.GITHUB }} + with: + tfcheck: 'point-to-site-with-ad-example / Check code format' +... diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 3e88b85..c2a8cd4 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -6,8 +6,8 @@ on: - "*" workflow_dispatch: jobs: - call-workflow-changelog: - uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master + changelog: + uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.0.10 secrets: inherit with: - branch: 'master' \ No newline at end of file + branch: 'master' diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 8b60bee..1eb0243 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -13,29 +13,28 @@ jobs: uses: actions/checkout@master - name: 'Set up Python 3.7' - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: 'create readme' - uses: 'clouddrove/github-actions@v9.0.2' + uses: 'clouddrove/github-actions@9.0.3' with: actions_subcommand: 'readme' github_token: '${{ secrets.GITHUB }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: 'pre-commit check errors' - uses: pre-commit/action@v2.0.0 + uses: pre-commit/action@v3.0.0 continue-on-error: true - name: 'pre-commit fix erros' - uses: pre-commit/action@v2.0.0 + uses: pre-commit/action@v3.0.0 continue-on-error: true - name: 'push readme' - uses: 'clouddrove/github-actions@v9.0.2' + uses: 'clouddrove/github-actions@9.0.3' continue-on-error: true with: actions_subcommand: 'push' diff --git a/.github/workflows/semantic-releaser.yml b/.github/workflows/semantic-releaser.yml deleted file mode 100644 index 6e685a0..0000000 --- a/.github/workflows/semantic-releaser.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Release - -on: - push: - branches: - - main - paths: - - '**.tf' - - '!examples/**.tf' - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - run: npx semantic-release diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml deleted file mode 100644 index 27cbe32..0000000 --- a/.github/workflows/static-checks.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: static-checks - -on: - pull_request: - -jobs: - versionExtract: - name: Get min/max versions - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Terraform min/max versions - id: minMax - uses: clowdhaus/terraform-min-max@main - outputs: - minVersion: ${{ steps.minMax.outputs.minVersion }} - maxVersion: ${{ steps.minMax.outputs.maxVersion }} - - versionEvaluate: - name: Evaluate Terraform versions - runs-on: ubuntu-latest - needs: versionExtract - strategy: - fail-fast: false - matrix: - version: - - ${{ needs.versionExtract.outputs.minVersion }} - - ${{ needs.versionExtract.outputs.maxVersion }} - directory: - - example/ - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Terraform v${{ matrix.version }} - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: ${{ matrix.version }} - - - name: Init & validate v${{ matrix.version }} - run: | - cd ${{ matrix.directory }} - terraform init - terraform validate - - name: tflint - uses: reviewdog/action-tflint@master - with: - tflint_version: v0.29.0 - github_token: ${{ secrets.GITHUB_TOKEN }} - working_directory: ${{ matrix.directory }} - fail_on_error: 'true' - filter_mode: 'nofilter' - flags: '--module' - - format: - name: Check code format - runs-on: ubuntu-latest - needs: versionExtract - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }} - uses: hashicorp/setup-terraform@v1 - with: - terraform_version: ${{ needs.versionExtract.outputs.maxVersion }} - - - name: Check Terraform format changes - run: terraform fmt --recursive -check=true diff --git a/.github/workflows/tf-checks.yml b/.github/workflows/tf-checks.yml new file mode 100644 index 0000000..2b010aa --- /dev/null +++ b/.github/workflows/tf-checks.yml @@ -0,0 +1,21 @@ +name: tf-checks +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + point-to-site-with-ad-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.10 + with: + working_directory: './_example/point-to-site-with-ad/' + + point-to-site-with-certificate-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.10 + with: + working_directory: './_example/point-to-site-with-certificate/' + + site-to-site-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.10 + with: + working_directory: './_example/site-to-site/' diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml new file mode 100644 index 0000000..e52fe96 --- /dev/null +++ b/.github/workflows/tflint.yml @@ -0,0 +1,11 @@ +name: tf-lint +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + tf-lint: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.10 + secrets: + GITHUB: ${{ secrets.GITHUB }} diff --git a/.github/workflows/tfsec.yml b/.github/workflows/tfsec.yml index 9aaf588..cac5e20 100644 --- a/.github/workflows/tfsec.yml +++ b/.github/workflows/tfsec.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: jobs: tfsec: - uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master + uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.0.10 secrets: inherit with: - working_directory: '.' \ No newline at end of file + working_directory: '.' diff --git a/README.yaml b/README.yaml index 4e9ac20..4babaaf 100644 --- a/README.yaml +++ b/README.yaml @@ -15,9 +15,12 @@ github_repo: clouddrove/terraform-azure-vpn # Badges to display badges: - - name: "Terraform" - image: "https://img.shields.io/badge/Terraform-v1.1.7-green" - url: "https://www.terraform.io" + - name: "Latest Release" + image: "https://img.shields.io/github/release/clouddrove/terraform-azure-dns.svg" + url: "https://github.com/clouddrove/terraform-azure-dns/releases/latest" + - name: "tfsec" + image: "https://github.com/clouddrove/terraform-azure-dns/actions/workflows/tfsec.yml/badge.svg" + url: "https://github.com/clouddrove/terraform-azure-dns/actions/workflows/tfsec.yml" - name: "Licence" image: "https://img.shields.io/badge/License-APACHE-blue.svg" url: "LICENSE.md" @@ -43,48 +46,52 @@ usage: |- name = "app" environment = "test" label_order = ["name", "environment"] - vpn_ad = true - resource_group_name = module.resource_group.resource_group_name - virtual_network_name = module.vnet.vnet_name[0] - vpn_client_configuration = { + vpn_ad = true + resource_group_name = module.resource_group.resource_group_name + subnet_id = module.subnet.specific_subnet_id[0] + vpn_gw_generation = "Generation1" + sku = "VpnGw1" + vpn_client_configuration = { address_space = "172.16.200.0/24" vpn_client_protocols = ["OpenVPN"] vpn_auth_types = ["AAD"] - aad_tenant = "https://login.microsoftonline.com/bcffb719XXXXXXXXXXXX7ebfb2f7bdd" + aad_tenant = "https://login.microsoftonline.com/xxxxxxxxxxxxxxx" aad_audience = "41b23e61-6c1e-4545-b367-cd054e0ed4b4" - aad_issuer = "https://sts.windows.net/bcffb719XXXXXXXXXXXX7ebfb2f7bdd/" + aad_issuer = "https://sts.windows.net/xxxxxxxxxxxxxxxxxxxx/" } #### enable diagnostic setting diagnostic_setting_enable = false log_analytics_workspace_id = "" - } - ``` + } + ``` ```hcl - # vpn with certificate + # vpn with certificate module "vpn" { - source = "clouddrove/vpn/azure" - version = "1.0.0" - depends_on = [module.vnet] - name = "app" - environment = "test" - label_order = ["name", "environment"] - vpn_with_certificate = true - resource_group_name = module.resource_group.resource_group_name - virtual_network_name = module.vnet.vnet_name[0] + source = "clouddrove/vpn/azure" + version = "1.0.0" + depends_on = [module.vnet] + name = "app" + environment = "test" + label_order = ["name", "environment"] + vpn_with_certificate = true + resource_group_name = module.resource_group.resource_group_name + subnet_id = module.subnet.specific_subnet_id[0] + vpn_gw_generation = "Generation1" + sku = "Basic" #### enable diagnostic setting diagnostic_setting_enable = false log_analytics_workspace_id = "" - vpn_client_configuration_c = { + vpn_client_configuration_c = { address_space = "172.16.201.0/24" - vpn_client_protocols = ["OpenVPN", "IkeV2"] + vpn_client_protocols = ["SSTP"] certificate = <