-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
285 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,21 +6,29 @@ RUN apt-get update && \ | |
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg | ||
gnupg \ | ||
lsb-release | ||
|
||
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] | ||
|
||
# Install gcloud | ||
# ref: https://cloud.google.com/sdk/docs/install#deb | ||
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ | ||
| gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg | ||
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \ | ||
| gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ | ||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \ | ||
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | ||
|
||
# Install Trivy | ||
# ref: https://trivy.dev/dev/getting-started/installation/ | ||
RUN curl https://aquasecurity.github.io/trivy-repo/deb/public.key | apt-key add - && \ | ||
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" \ | ||
| tee -a /etc/apt/sources.list.d/trivy.list | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
google-cloud-cli | ||
google-cloud-cli \ | ||
trivy | ||
|
||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm | ||
|
@@ -29,4 +37,5 @@ LABEL maintainer="a5chin <[email protected]>" | |
|
||
COPY --from=builder --chown=vscode: /usr/bin/python* /usr/bin/python* | ||
COPY --from=builder --chown=vscode: /usr/bin/gcloud /usr/bin/gcloud | ||
COPY --from=builder --chown=vscode: /usr/bin/trivy /usr/bin/trivy | ||
COPY --from=builder --chown=vscode: /usr/lib /usr/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Terraform | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
matrix: ${{ steps.extract_modules.outputs.matrix }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Extract terraform modules | ||
id: extract_modules | ||
run: | | ||
echo "matrix=$(ls modules | jq -R -s -c '{ "modules": split("\n")[:-1] }')" > $GITHUB_OUTPUT | ||
format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: 1.9.8 | ||
|
||
- name: Terraform fmt | ||
run: terraform fmt -check -recursive | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
name: Cache plugin dir | ||
with: | ||
path: ~/.tflint.d/plugins | ||
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }} | ||
|
||
- uses: terraform-linters/setup-tflint@v4 | ||
name: Setup TFLint | ||
with: | ||
tflint_version: latest | ||
|
||
- name: Init TFLint | ||
run: tflint --init | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: tflint | ||
run: tflint | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
needs: [setup] | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }} | ||
|
||
defaults: | ||
run: | ||
working-directory: modules/${{ matrix.modules }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: 1.9.8 | ||
|
||
- name: Run terraform test | ||
run: | | ||
terraform init | ||
terraform test | ||
validate: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: 1.9.8 | ||
|
||
- name: Terraform validate | ||
run: terraform validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tflint { | ||
required_version = ">= 0.50" | ||
} | ||
|
||
config { | ||
call_module_type = "all" | ||
} | ||
|
||
plugin "google" { | ||
enabled = true | ||
version = "0.30.0" | ||
source = "github.com/terraform-linters/tflint-ruleset-google" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.