Jacob McCann
8 years ago
1 changed files with 24 additions and 106 deletions
@ -1,123 +1,41 @@ |
|||
# drone-terraform |
|||
|
|||
[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-terraform/status.svg)](http://beta.drone.io/drone-plugins/drone-terraform) |
|||
[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-terraform/coverage.svg)](https://aircover.co/drone-plugins/drone-terraform) |
|||
[![](https://badge.imagelayers.io/plugins/drone-terraform:latest.svg)](https://imagelayers.io/?images=plugins/drone-terraform:latest 'Get your own badge on imagelayers.io') |
|||
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](DOCS.md). |
|||
|
|||
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](DOCS.md). |
|||
## Build |
|||
|
|||
## Binary |
|||
|
|||
Build the binary using `make`: |
|||
Build the binary with the following commands: |
|||
|
|||
``` |
|||
make deps build |
|||
go build |
|||
go test |
|||
``` |
|||
|
|||
### Example |
|||
## Docker |
|||
|
|||
```sh |
|||
./drone-terraform <<EOF |
|||
{ |
|||
"repo": { |
|||
"clone_url": "git://github.com/drone/drone", |
|||
"owner": "drone", |
|||
"name": "drone", |
|||
"full_name": "drone/drone" |
|||
}, |
|||
"system": { |
|||
"link_url": "https://beta.drone.io" |
|||
}, |
|||
"build": { |
|||
"number": 22, |
|||
"status": "success", |
|||
"started_at": 1421029603, |
|||
"finished_at": 1421029813, |
|||
"message": "Update the Readme", |
|||
"author": "johnsmith", |
|||
"author_email": "john.smith@gmail.com", |
|||
"event": "push", |
|||
"branch": "master", |
|||
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c", |
|||
"ref": "refs/heads/master" |
|||
}, |
|||
"workspace": { |
|||
"root": "/drone/src", |
|||
"path": "/drone/src/github.com/drone/drone" |
|||
}, |
|||
"vargs": { |
|||
"plan": false, |
|||
"remote": { |
|||
"backend": "S3", |
|||
"config": { |
|||
"bucket": "my-terraform-config-bucket", |
|||
"key": "tf-states/my-project", |
|||
"region": "us-east-1" |
|||
} |
|||
}, |
|||
"vars": { |
|||
"app_name": "my-project", |
|||
"app_version": "1.0.0" |
|||
} |
|||
} |
|||
} |
|||
EOF |
|||
``` |
|||
Build the docker image with the following commands: |
|||
|
|||
## Docker |
|||
``` |
|||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo |
|||
docker build --rm=true -t jmccann/drone-terraform . |
|||
``` |
|||
|
|||
Build the container using `make`: |
|||
Please note incorrectly building the image for the correct x64 linux and with |
|||
GCO disabled will result in an error when running the Docker image: |
|||
|
|||
``` |
|||
make deps docker |
|||
docker: Error response from daemon: Container command |
|||
'/bin/drone-terraform' not found or does not exist. |
|||
``` |
|||
|
|||
### Example |
|||
## Usage |
|||
|
|||
```sh |
|||
docker run -i plugins/drone-terraform <<EOF |
|||
{ |
|||
"repo": { |
|||
"clone_url": "git://github.com/drone/drone", |
|||
"owner": "drone", |
|||
"name": "drone", |
|||
"full_name": "drone/drone" |
|||
}, |
|||
"system": { |
|||
"link_url": "https://beta.drone.io" |
|||
}, |
|||
"build": { |
|||
"number": 22, |
|||
"status": "success", |
|||
"started_at": 1421029603, |
|||
"finished_at": 1421029813, |
|||
"message": "Update the Readme", |
|||
"author": "johnsmith", |
|||
"author_email": "john.smith@gmail.com", |
|||
"event": "push", |
|||
"branch": "master", |
|||
"commit": "436b7a6e2abaddfd35740527353e78a227ddcb2c", |
|||
"ref": "refs/heads/master" |
|||
}, |
|||
"workspace": { |
|||
"root": "/drone/src", |
|||
"path": "/drone/src/github.com/drone/drone" |
|||
}, |
|||
"vargs": { |
|||
"plan": false, |
|||
"remote": { |
|||
"backend": "S3", |
|||
"config": { |
|||
"bucket": "my-terraform-config-bucket", |
|||
"key": "tf-states/my-project", |
|||
"region": "us-east-1" |
|||
} |
|||
}, |
|||
"vars": { |
|||
"app_name": "my-project", |
|||
"app_version": "1.0.0" |
|||
} |
|||
} |
|||
} |
|||
EOF |
|||
Execute from the working directory: |
|||
|
|||
``` |
|||
docker run --rm \ |
|||
-v $(pwd):$(pwd) \ |
|||
-w $(pwd) \ |
|||
jmccann/drone-terraform --plan |
|||
``` |
|||
|
Loading…
Reference in new issue