mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-18 09:38:33 +01:00
Improve CI pipeline
This commit is contained in:
76
.github/workflows/lint.yml
vendored
76
.github/workflows/lint.yml
vendored
@@ -2,40 +2,52 @@ name: Lint
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
tflint:
|
||||
name: TFLint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: TFLint
|
||||
uses: docker://wata727/tflint
|
||||
|
||||
fmt:
|
||||
name: Code Format
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: hashicorp/terraform:latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- run: terraform fmt --recursive -check=true
|
||||
|
||||
docs:
|
||||
name: Docs
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Install Deps
|
||||
run: brew install pre-commit terraform-docs terraform
|
||||
- name: Check Docs
|
||||
run: pre-commit run --show-diff-on-failure --all-files terraform_docs
|
||||
|
||||
validate:
|
||||
name: Validate
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: hashicorp/terraform:latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
# - uses: actions/setup-ruby@v1
|
||||
# with:
|
||||
# ruby-version: '2.4.6'
|
||||
# - name: Install Kitchen-Terraform
|
||||
# run: |
|
||||
# gem install bundler --no-document
|
||||
# bundle install
|
||||
- name: Install Terraform
|
||||
run: |
|
||||
export TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
|
||||
curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
|
||||
unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform
|
||||
mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/
|
||||
terraform -v
|
||||
- name: Validate Code
|
||||
env:
|
||||
AWS_REGION: 'us-east-1'
|
||||
TF_VAR_region: ${AWS_REGION}
|
||||
TF_WARN_OUTPUT_ERRORS: 1
|
||||
run: |
|
||||
terraform init
|
||||
terraform fmt -check=true
|
||||
terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
|
||||
- name: Validate Examples
|
||||
run: |
|
||||
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
|
||||
cd $example
|
||||
- uses: actions/checkout@master
|
||||
- name: Validate Code
|
||||
env:
|
||||
AWS_REGION: 'us-east-1'
|
||||
TF_WARN_OUTPUT_ERRORS: 1
|
||||
run: |
|
||||
terraform init
|
||||
terraform fmt -check=true
|
||||
terraform validate
|
||||
cd -
|
||||
done
|
||||
terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
|
||||
- name: Validate Examples
|
||||
run: |
|
||||
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
|
||||
cd $example
|
||||
terraform init
|
||||
terraform validate
|
||||
cd -
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user