Browse Source

Erumble/aws iam authenticator (#1)

* rename docker image

* add aws-iam-authenticator and update tf to 0.11.13

* install kubectl
pull/91/head
Eric Rumble 6 years ago
committed by GitHub
parent
commit
61ccc57503
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      CHANGELOG.md
  2. 36
      DOCS.md
  3. 38
      Dockerfile
  4. 11
      README.md
  5. 18
      build-docker.sh
  6. 2
      go.mod

7
CHANGELOG.md

@ -1,3 +1,10 @@
## 5.2-0.11.13 (2019-03-29)
* Forked from https://github.com/jmccann/drone-terraform
* Install aws-iam-authenticator
* Install kubectl
* Change module name and Docker image names from jmccann to GetTerminus
* Update embedded TF to `0.11.13`
## 5.2-0.11.11 (2019-02-22)
* Add `fmt` action

36
DOCS.md

@ -3,9 +3,9 @@ date: 2016-01-01T00:00:00+00:00
title: Terraform
author: jmccann
tags: [ infrastructure, build tool ]
repo: jmccann/drone-terraform
repo: getterminus/drone-terraform
logo: terraform.svg
image: jmccann/drone-terraform
image: getterminus/drone-terraform
---
The Terraform plugin applies the infrastructure configuration contained within the repository. The below pipeline configuration demonstrates simple usage which will run a `validate`, `plan` and `apply`:
@ -13,7 +13,7 @@ The Terraform plugin applies the infrastructure configuration contained within t
```yaml
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
```
Example configuration passing `vars` to terraform commands:
@ -21,7 +21,7 @@ Example configuration passing `vars` to terraform commands:
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ vars:
+ app_name: my-project
+ app_version: 1.0.0
@ -32,7 +32,7 @@ Example of explicitly specifying `actions` to perform a dry run.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ actions:
+ - validate
+ - plan
@ -47,7 +47,7 @@ for more details.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ secrets:
+ - source: terraform_secret
+ target: tf_var_my_secret
@ -58,12 +58,12 @@ pipeline:
```diff
pipeline:
terraform_1:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ environment:
+ TF_VAR_MY_SECRET: ${TERRAFORM_SECRET}
terraform_2:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
plan: false
+ sensitive: true
+ vars:
@ -78,7 +78,7 @@ what command is actually being ran.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ sensitive: true
```
@ -89,7 +89,7 @@ specified instead of using the embedded version that is included.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ tf_version: 0.10.3
```
@ -100,7 +100,7 @@ specified in a `.tf` file. You can then pass additional options via the `.drone
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ init_options:
+ backend-config:
+ - "bucket=my-terraform-config-bucket"
@ -116,7 +116,7 @@ CA Certificate. You can inject your CA Certificate into the plugin by using
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ ca_cert: |
+ -----BEGIN CERTIFICATE-----
+ asdfsadf
@ -133,7 +133,7 @@ See [the discussion](https://github.com/hashicorp/terraform/issues/1275) in the
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ role_arn_to_assume: arn:aws:iam::account-of-role-to-assume:role/name-of-role
```
@ -144,7 +144,7 @@ and you want to use different drone configurations to apply different environmen
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ root_dir: some/path/here
```
@ -155,7 +155,7 @@ all resources will be planned/applied against as the default behavior.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ targets:
+ - aws_security_group.generic_sg
+ - aws_security_group.app_sg
@ -167,7 +167,7 @@ If you want to change Terraform's default parallelism (currently equal to 10) th
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ parallelism: 2
```
@ -176,7 +176,7 @@ Destroying the service can be done by specifying `plan-destroy` and `destroy` ac
```yaml
pipeline:
destroy:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ actions:
+ - plan-destroy
+ - destroy
@ -187,7 +187,7 @@ Formatting the Terraform configuration files can be done by specifying the `fmt`
```yaml
pipeline:
fmt:
image: jmccann/drone-terraform:5
image: getterminus/drone-terraform:5
+ actions:
+ - fmt
+ fmt_options:

38
Dockerfile

@ -1,6 +1,6 @@
# Docker image for the Drone Terraform plugin
#
# docker build -t jmccann/drone-terraform:latest .
# docker build -t getterminus/drone-terraform:latest .
FROM golang:1.11-alpine AS builder
RUN apk add --no-cache git
@ -15,16 +15,26 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/dro
FROM alpine:3.9
RUN apk -U add \
ca-certificates \
git \
wget \
openssh-client && \
rm -rf /var/cache/apk/*
ENV TERRAFORM_VERSION 0.11.11
RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -O terraform.zip && \
unzip terraform.zip -d /bin && \
rm -f terraform.zip
COPY --from=builder /go/bin/drone-terraform /bin/
ENTRYPOINT ["/bin/drone-terraform"]
ca-certificates \
curl \
git \
openssh-client && \
rm -rf /var/cache/apk/*
ENV INSTALL_DIR /usr/local/bin
ENV TERRAFORM_VERSION 0.11.13
RUN curl -LO https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ${INSTALL_DIR} && \
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip
ENV AWS_IAM_AUTHENTICATOR_VERSION 1.12.7/2019-03-27
RUN curl -L -o ${INSTALL_DIR}/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/${AWS_IAM_AUTHENTICATOR_VERSION}/bin/linux/amd64/aws-iam-authenticator && \
chmod +x ${INSTALL_DIR}/aws-iam-authenticator
ENV KUBECTL_VERSION v1.14.0
RUN curl -L -o ${INSTALL_DIR}/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
chmod +x ${INSTALL_DIR}/kubectl
COPY --from=builder /go/bin/drone-terraform ${INSTALL_DIR}/
ENTRYPOINT ["drone-terraform"]

11
README.md

@ -1,9 +1,10 @@
# drone-terraform
[![Build Status](http://beta.drone.io/api/badges/jmccann/drone-terraform/status.svg)](http://beta.drone.io/jmccann/drone-terraform)
Drone plugin to execute Terraform plan and apply. For the usage information and
a listing of the available options please take a look at [the docs](https://github.com/jmccann/drone-terraform/blob/master/DOCS.md).
a listing of the available options please take a look at [the docs](https://github.com/GetTerminus/drone-terraform/blob/master/DOCS.md).
This fork is intended to be a long term resource, and will not be merged upstream.
Changes downstream will be accepted. Original documentation can be found [here](https://github.com/jmccann/drone-terraform/blob/master/DOCS.md).
## Build
@ -21,7 +22,7 @@ go build
Build the docker image with the following commands:
```
docker build --rm=true -t jmccann/drone-terraform .
docker build --rm=true -t getterminus/drone-terraform .
```
## Usage
@ -32,7 +33,7 @@ Execute from the working directory:
docker run --rm \
-v $(pwd):$(pwd) \
-w $(pwd) \
jmccann/drone-terraform:latest --plan
getterminus/drone-terraform:latest --plan
```
## Drone 0.4

18
build-docker.sh

@ -25,15 +25,15 @@ if [[ "$ans" != "Y" && "$ans" != "y" ]]; then
exit 0
fi
docker build -t jmccann/drone-terraform:latest .
docker build -t getterminus/drone-terraform:latest .
set -x
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor}
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor}-${tf_ver}
docker push jmccann/drone-terraform:latest
docker push jmccann/drone-terraform:${major}
docker push jmccann/drone-terraform:${major}.${minor}
docker push jmccann/drone-terraform:${major}.${minor}-${tf_ver}
docker tag getterminus/drone-terraform:latest getterminus/drone-terraform:${major}
docker tag getterminus/drone-terraform:latest getterminus/drone-terraform:${major}.${minor}
docker tag getterminus/drone-terraform:latest getterminus/drone-terraform:${major}.${minor}-${tf_ver}
docker push getterminus/drone-terraform:latest
docker push getterminus/drone-terraform:${major}
docker push getterminus/drone-terraform:${major}.${minor}
docker push getterminus/drone-terraform:${major}.${minor}-${tf_ver}
set +x

2
go.mod

@ -1,4 +1,4 @@
module github.com/jmccann/drone-terraform
module github.com/GetTerminus/drone-terraform
require (
github.com/Sirupsen/logrus v0.0.0-20160829202321-3ec0642a7fb6

Loading…
Cancel
Save