Skip to content

Commit 8b0cc9d

Browse files
authored
Merge pull request #59 from maddevsio/feature/terraform-utils
Feature/terraform utils
2 parents 4c490b1 + aa20e02 commit 8b0cc9d

File tree

5 files changed

+87
-14
lines changed

5 files changed

+87
-14
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'aws-eks-utils'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
paths:
8+
- 'docker/aws-eks-utils/Dockerfile'
9+
10+
jobs:
11+
push_to_registries:
12+
name: Build and Push Docker image
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_USERNAME }}
21+
password: ${{ secrets.DOCKER_PASSWORD }}
22+
- name: Build and Push
23+
uses: docker/build-push-action@v2
24+
with:
25+
push: true
26+
context: docker/aws-eks-utils/
27+
tags: maddevsio/aws-eks-utils:latest

.github/workflows/terraform-ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: 'Terraform-validate'
1313
runs-on: ubuntu-latest
1414
container:
15-
image: hashicorp/terraform:0.15.1
15+
image: maddevsio/terraform-utils:latest
1616
env:
1717
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1818
steps:
@@ -36,21 +36,22 @@ jobs:
3636
name: 'Terraform-format'
3737
runs-on: ubuntu-latest
3838
container:
39-
image: hashicorp/terraform:0.15.1
39+
image: maddevsio/terraform-utils:latest
4040
env:
4141
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
4242
steps:
4343
- name: Checkout
4444
uses: actions/checkout@v2
4545
- name: Terraform Format
4646
run: terraform fmt -recursive -write=false -check .
47+
working-directory: ./terraform
4748

4849
# Checks that all Terraform configuration files tflint
4950
terraform-tflint:
5051
name: 'Terraform-tflint'
5152
runs-on: ubuntu-latest
5253
container:
53-
image: wata727/tflint
54+
image: maddevsio/terraform-utils:latest
5455
env:
5556
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5657
steps:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Terraform-utils'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
paths:
8+
- 'docker/terraform-utils/Dockerfile'
9+
10+
jobs:
11+
push_to_registries:
12+
name: Build and Push Docker image
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
- name: Login to DockerHub
18+
uses: docker/login-action@v1
19+
with:
20+
username: ${{ secrets.DOCKER_USERNAME }}
21+
password: ${{ secrets.DOCKER_PASSWORD }}
22+
- name: Build and Push
23+
uses: docker/build-push-action@v2
24+
with:
25+
push: true
26+
context: docker/terraform-utils/
27+
tags: maddevsio/terraform-utils:latest

docker/aws-eks-utils/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM alpine:3.10.1
2-
ARG TERRAFORM_VERSION="0.12.25"
3-
ARG TERRAGRUNT_VERSION="0.22.4"
4-
ARG HELM_VERSION="3.0.2"
5-
ARG HELMFILE_VERSION="0.98.3"
6-
ARG KUBECTL_VERSION="1.15.11"
1+
FROM alpine:3.13.5
2+
3+
ARG TERRAFORM_VERSION="0.15.1"
4+
ARG TERRAGRUNT_VERSION="0.29.2"
5+
ARG HELM_VERSION="3.5.4"
6+
ARG HELMFILE_VERSION="0.138.7"
7+
ARG KUBECTL_VERSION="1.21.0"
78
ENV BASE_URL="https://get.helm.sh"
89
ENV TAR_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz"
910

@@ -13,7 +14,7 @@ RUN echo "**** install Python ****" && \
1314
if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
1415
\
1516
echo "**** install pip ****" && \
16-
python3 -m ensurepip && \
17+
python3 -m ensurepip && \
1718
pip3 install --no-cache --upgrade pip setuptools wheel && \
1819
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi
1920

@@ -50,15 +51,14 @@ RUN wget https://storage.googleapis.com/kubernetes-release/release/v"$KUBECTL_VE
5051
RUN curl -L https://amazon-eks.s3-us-west-2.amazonaws.com/1.13.7/2019-06-11/bin/linux/amd64/aws-iam-authenticator -o /usr/local/bin/aws-iam-authenticator \
5152
&& chmod +x /usr/local/bin/aws-iam-authenticator
5253

53-
#Install docker
54-
RUN apk add --no-cache --update docker
54+
#Install docker
55+
RUN apk add --no-cache --update docker
5556

5657
#Install helmfile
5758
RUN wget https://github.com/roboll/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_linux_amd64 \
5859
&& chmod +x helmfile_linux_amd64 && mv helmfile_linux_amd64 /bin/helmfile
5960

6061
# Install ssh
61-
RUN apk add openssh
62-
62+
RUN apk add openssh
6363

6464
ENTRYPOINT [""]

docker/terraform-utils/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM alpine:3.13.5
2+
ARG TERRAFORM_VERSION="0.15.1"
3+
4+
WORKDIR /tmp
5+
6+
#Install tfenv for terraform
7+
RUN apk add --update --no-cache openssl git bash curl unzip sudo && \
8+
git clone https://github.com/tfutils/tfenv.git /usr/bin/.tfenv && \
9+
ln -s /usr/bin/.tfenv/bin/* /usr/bin && \
10+
chmod +x /usr/bin/tfenv
11+
12+
#Install terraform
13+
RUN tfenv install $TERRAFORM_VERSION
14+
15+
#Install tflint
16+
RUN curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
17+
18+
ENTRYPOINT [""]

0 commit comments

Comments
 (0)