0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-21 14:20:40 +00:00

Update the README.md to support new plugin structure for Drone 0.5

This commit is contained in:
Jacob McCann 2016-10-20 19:51:42 +05:30
parent b89636d36e
commit b77fa7f0b3

132
README.md
View File

@ -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
```
### Example
```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
go build
go test
```
## Docker
Build the container using `make`:
Build the docker image with the following commands:
```
make deps docker
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo
docker build --rm=true -t jmccann/drone-terraform .
```
### Example
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:
```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
```
docker: Error response from daemon: Container command
'/bin/drone-terraform' not found or does not exist.
```
## Usage
Execute from the working directory:
```
docker run --rm \
-v $(pwd):$(pwd) \
-w $(pwd) \
jmccann/drone-terraform --plan
```