diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cdab7d5..a4b78e6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,6 +10,6 @@ updates: schedule: interval: "weekly" - package-ecosystem: "terraform" # See documentation for possible values - directory: "_example/" # Location of package manifests + directory: "example/" # Location of package manifests schedule: interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/auto_assignee.yml b/.github/workflows/auto_assignee.yml new file mode 100644 index 0000000..77d5fdf --- /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@master + secrets: + GITHUB: ${{ secrets.GITHUB }} + with: + assignees: 'clouddrove-ci' \ No newline at end of file diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..a7840ce --- /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@master + secrets: + GITHUB: ${{ secrets.GITHUB }} + with: + tfcheck: 'basic / Check code format' + ... \ No newline at end of file diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index cf5c5d7..4b735f5 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@1.2.1 + changelog: + uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master secrets: inherit with: branch: 'master' \ No newline at end of file diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 8b60bee..444164d 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -1,54 +1,15 @@ -name: 'Create README.md file' +name: Readme Workflow on: push: branches: - master - + paths-ignore: + - 'README.md' + - 'docs/**' + workflow_dispatch: jobs: - readme-create: - name: 'readme-create' - runs-on: ubuntu-latest - steps: - - name: 'Checkout' - uses: actions/checkout@master - - - name: 'Set up Python 3.7' - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: 'create readme' - uses: 'clouddrove/github-actions@v9.0.2' - 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 - continue-on-error: true - - - name: 'pre-commit fix erros' - uses: pre-commit/action@v2.0.0 - continue-on-error: true - - - name: 'push readme' - uses: 'clouddrove/github-actions@v9.0.2' - continue-on-error: true - with: - actions_subcommand: 'push' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Slack Notification' - uses: clouddrove/action-slack@v2 - with: - status: ${{ job.status }} - fields: repo,author - author_name: 'CloudDrove' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required - if: always() + README: + uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@master + secrets: + TOKEN : ${{ secrets.GITHUB }} + SLACK_WEBHOOK_TERRAFORM: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} \ No newline at end of file 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 6e5f16b..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..9dd5d2e --- /dev/null +++ b/.github/workflows/tf-checks.yml @@ -0,0 +1,11 @@ +name: tf-checks +on: + push: + branches: [ master ] + pull_request: + workflow_dispatch: +jobs: + tf-checks-aws-managed-example: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master + with: + working_directory: './example/' \ No newline at end of file diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml new file mode 100644 index 0000000..ee98182 --- /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@master + secrets: + GITHUB: ${{ secrets.GITHUB }} \ No newline at end of file diff --git a/.github/workflows/tfsec.yml b/.github/workflows/tfsec.yml index 418ce1c..9aaf588 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@1.2.1 + uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master secrets: inherit with: working_directory: '.' \ No newline at end of file diff --git a/_example/example.tf b/example/example.tf similarity index 97% rename from _example/example.tf rename to example/example.tf index 3bdbad8..7471b7e 100644 --- a/_example/example.tf +++ b/example/example.tf @@ -1,4 +1,5 @@ provider "azurerm" { + subscription_id = "000000-11111-1223-XXX-XXXXXXXXXXXX" features {} } diff --git a/_example/output.tf b/example/output.tf similarity index 100% rename from _example/output.tf rename to example/output.tf diff --git a/example/s.sh b/example/s.sh new file mode 100755 index 0000000..9995648 --- /dev/null +++ b/example/s.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Function to update the versions.tf file +update_providers_file() { + local version=$1 + cat > versions.tf << EOF +# Terraform version +terraform { + required_version = ">= 1.0.0" +} + +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "$version" + } + } +} +EOF + echo "Updated versions.tf with AzureRM version $version" +} + +# Main script +echo "Terraform AzureRM Provider Version Tester" +echo "----------------------------------------" + +# Ask for the version number +read -p "Enter the AzureRM provider version to test (e.g., 4.0.1): " version + +# Update the versions.tf file +update_providers_file $version + +# Remove .terraform directory and .terraform.lock.hcl file +echo "Removing .terraform directory and .terraform.lock.hcl file..." +rm -rf .terraform .terraform.lock.hcl + +# Run terraform init +echo "Running terraform init..." +terraform init + +# Check if terraform init was successful +if [ $? -eq 0 ]; then + # Run terraform plan after init + echo "Terraform init completed successfully. Running terraform plan..." + terraform plan +else + echo "Terraform init failed. Please check the configuration." +fi + diff --git a/example/versions.tf b/example/versions.tf new file mode 100644 index 0000000..e75ddf2 --- /dev/null +++ b/example/versions.tf @@ -0,0 +1,13 @@ +# Terraform version +terraform { + required_version = ">= 1.0.0" +} + +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = ">=3.112.0" + } + } +} diff --git a/main.tf b/main.tf index be95602..0caa0e7 100644 --- a/main.tf +++ b/main.tf @@ -52,12 +52,14 @@ resource "azurerm_lb" "load-balancer" { sku = var.lb_sku frontend_ip_configuration { - name = var.frontend_name - private_ip_address = var.frontend_private_ip_address - private_ip_address_allocation = var.frontend_private_ip_address_allocation - private_ip_address_version = var.frontend_private_ip_address_version - public_ip_address_id = try(azurerm_public_ip.default[0].id, null) - subnet_id = var.frontend_subnet_id + name = var.frontend_name + #when we are not using private ip + # private_ip_address = var.frontend_private_ip_address + # private_ip_address_allocation = var.frontend_private_ip_address_allocation + # private_ip_address_version = var.frontend_private_ip_address_version + + public_ip_address_id = try(azurerm_public_ip.default[0].id, null) + subnet_id = var.frontend_subnet_id } timeouts { diff --git a/variables.tf b/variables.tf index 5b324f4..b22f064 100644 --- a/variables.tf +++ b/variables.tf @@ -176,17 +176,7 @@ variable "frontend_name" { default = "myip" } -variable "frontend_private_ip_address" { - description = "(Optional) Private ip address to assign to frontend. Use it with type = private" - type = string - default = "" -} -variable "frontend_private_ip_address_allocation" { - description = "(Optional) Frontend ip allocation type (Static or Dynamic)" - type = string - default = "Dynamic" -} variable "frontend_private_ip_address_version" { description = "(Optional) The version of IP that the Private IP Address is. Possible values are `IPv4` or `IPv6`." diff --git a/versions.tf b/versions.tf index 90a7e6a..853cd71 100644 --- a/versions.tf +++ b/versions.tf @@ -7,7 +7,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.89.0" + version = ">=3.112.0" } } } \ No newline at end of file