Skip to content

Commit

Permalink
Merge pull request #20 from mineiros-io/lukas/upgrade-google-provider…
Browse files Browse the repository at this point in the history
…-to-v5

feat: add support for google v5 provider
  • Loading branch information
Esanim authored Feb 27, 2024
2 parents 1740722 + 93bf6f7 commit e6140af
Show file tree
Hide file tree
Showing 18 changed files with 713 additions and 861 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Preview

on:
pull_request:

concurrency:
group: terraform-google-pubsub-topic
cancel-in-progress: false

jobs:
pre-commit:
runs-on: ubuntu-latest
name: Static Analysis
steps:
- name: Checkout
# actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Setup asdf
# asdf-vm/actions/[email protected]
uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6

- name: Install tools via asdf
run: asdf install

- name: Set up Golang
# actions/[email protected]
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.22.0

- name: Set up Terradoc
# for security reasons we pin commit ids and not tags.
# mineiros-io/terradoc@main -> af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a
run: go install github.com/mineiros-io/terradoc/cmd/terradoc@af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a
env:
GOPROXY: direct

- name: Cache plugin dir
# for security reasons we pin commit ids and not tags.
# actions/[email protected] -> 13aacd865c20de90d75de3b17ebe84f7a17d57d2
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
with:
path: ~/.tflint.d/plugins
key: tflint-${{ hashFiles('.tflint.hcl') }}

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- name: Setup and run pre-commit
# for security reasons we pin commit ids and not tags.
# pre-commit/[email protected] -> 2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd

unit-tests:
# needs: pre-commit
runs-on: ubuntu-latest
name: Unit Tests
steps:
- name: Checkout
# actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Setup asdf
# asdf-vm/actions/[email protected]
uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6

- name: Install tools via asdf
run: asdf install

- name: Set up Golang
# actions/[email protected]
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.22.0

- name: Run Unit Tests
run: make test/unit-tests
env:
GOOGLE_CREDENTIALS: ${{ secrets.MINEIROS_TESTING_GCP_SA_KEY_FILE }}
TEST_GCP_PROJECT: ${{ secrets.MINEIROS_TESTING_GCP_PROJECT }}
TEST_GCP_ORG_DOMAIN: ${{ secrets.MINEIROS_TESTING_GCP_ORG_DOMAIN }}
116 changes: 116 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release

on:
push:
branches:
- main

concurrency:
group: terraform-google-pubsub-topic
cancel-in-progress: false

jobs:
pre-commit:
runs-on: ubuntu-latest
name: Static Analysis
steps:
- name: Checkout
# actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Setup asdf
# asdf-vm/actions/[email protected]
uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6

- name: Install tools via asdf
run: asdf install

- name: Set up Golang
# actions/[email protected]
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.22.0

- name: Set up Terradoc
# for security reasons we pin commit ids and not tags.
# mineiros-io/terradoc@main -> af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a
run: go install github.com/mineiros-io/terradoc/cmd/terradoc@af1a7b3ae3635958adf5ee2f40e0c3e70fd0803a
env:
GOPROXY: direct

- name: Cache plugin dir
# for security reasons we pin commit ids and not tags.
# actions/[email protected] -> 13aacd865c20de90d75de3b17ebe84f7a17d57d2
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
with:
path: ~/.tflint.d/plugins
key: tflint-${{ hashFiles('.tflint.hcl') }}

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- name: Setup and run pre-commit
# for security reasons we pin commit ids and not tags.
# pre-commit/[email protected] -> 2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd

unit-tests:
# needs: pre-commit
runs-on: ubuntu-latest
name: Unit Tests
steps:
- name: Checkout
# actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Setup asdf
# asdf-vm/actions/[email protected]
uses: asdf-vm/actions/plugins-add@05e0d2ed97b598bfce82fd30daf324ae0c4570e6

- name: Install tools via asdf
run: asdf install

- name: Set up Golang
# actions/[email protected]
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.22.0

- name: Run Unit Tests
run: make test/unit-tests
env:
GOOGLE_CREDENTIALS: ${{ secrets.MINEIROS_TESTING_GCP_SA_KEY_FILE }}
TEST_GCP_PROJECT: ${{ secrets.MINEIROS_TESTING_GCP_PROJECT }}
TEST_GCP_ORG_DOMAIN: ${{ secrets.MINEIROS_TESTING_GCP_ORG_DOMAIN }}

release:
needs:
- pre-commit
- unit-tests
permissions:
contents: write
issues: write
runs-on: ubuntu-latest
steps:
- name: Checkout
# actions/[email protected]
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0

- name: Semantic Release
# codfish/[email protected]
uses: codfish/semantic-release-action@07170c8b1613177f0f3aa4d2224e2e0933cd732c
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
plugins: |
['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/github']
117 changes: 0 additions & 117 deletions .github/workflows/tests.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ vendor
crash.log

.terraform.lock.hcl
.tool-versions
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/mineiros-io/pre-commit-hooks
rev: v0.4.1
rev: v0.5.1
hooks:
- id: phony-targets
- id: terradoc-validate
Expand All @@ -11,3 +11,8 @@ repos:
- id: terraform-validate
exclude: ^examples|.terraform/
- id: tflint
- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
hooks:
- id: yamllint
args: ['-s']
13 changes: 13 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branches": [
"main"
],
"plugins": [
["@semantic-release/npm", {
"npmPublish": false
}],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}
18 changes: 18 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
rule "terraform_unused_declarations" {
enabled = false
}

rule "terraform_required_providers" {
enabled = false
}

plugin "terraform" {
enabled = true
preset = "recommended"
}

plugin "google" {
enabled = true
version = "0.26.0"
source = "github.com/terraform-linters/tflint-ruleset-google"
}
4 changes: 4 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
terraform 1.5.7
terramate 0.4.5
tflint 0.50.2
pre-commit 3.6.1
5 changes: 5 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends: default
rules:
line-length: disable
document-start: disable
truthy: disable
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A [Terraform](https://www.terraform.io) module for creating and managing a
[Google Cloud](https://cloud.google.com/)

**_This module supports Terraform version 1
and is compatible with the Terraform Google Provider version 4._**
and is compatible with the Terraform Google Provider version 4._** and 5_**

This module is part of our Infrastructure as Code (IaC) framework
that enables our users and customers to easily deploy and manage reusable,
Expand Down
Loading

0 comments on commit e6140af

Please sign in to comment.