Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maratoid committed Aug 18, 2015
1 parent 6b256d1 commit 066b779
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
# terraform-provider-exec

Provides an ability to execute arbitrary commands
# terraform-provider-execute

Terraform plugin mostly based on https://github.com/gosuri/terraform-exec-provider (thanks!!!). Provides an ability to execute arbitrary commands on Terraform create and destroy.

## Usage

resource "exec" "command" {
command "/path/to/command"
destroy_command "/path/to/command"
}

### Attribute reference

* `command` - (Required) Command to execute
* `only_if` - (Optional) Guard attribute, to create the resource (Execute) the command only if this guard is satisfied. If the command returns 0, the guard is applied. If the command returns any other value, then the guard attribute is not applied.


### Examples
* `command` - (Required) Command to execute on terraform Create
* `destroy_command` - (Optional) Command to execute on terraform destroy
* `only_if` - (Optional) Guard attribute, to create the resource (Execute) the command only if this guard is satisfied. If the command returns 0, the guard is applied. If the command returns any other value, then the guard attribute is not applied.
* `timeout` - (Optional) Create/Destroy max timeout

The below example will run the command after creating VPCs, where `commands/peer-vpc` is shell script to add peering connection between VPCs and will be executed after the VPCs are created when `depends_on` attribute is specified.

resource "aws_vpc" "primary" {
cidr_block = "10.0.0.0/16"
}
### Examples

resource "aws_vpc" "app" {
cidr_block = "10.1.0.0/16"
}
The below example will create a 'testfile' file when you run 'terraform apply' and delete the 'testfile' file when you run 'terraform destroy'

resource "exec", "peer_vpcs" {
command = "commands/peer-vpc ${aws_vpc.primary.id} ${aws_vpc.app.id}"
depends_on = ["aws_vpc.primary.id","aws_vpc.app"]
resource "execute_command" "commands" {
command = "touch testfile"
destroy_command = "rm testfile"
}

## Installation

$ git clone https://github.com/gosuri/terraform-exec-provider.git
$ cd terraform-exec-provider
$ make install
$ go get

0 comments on commit 066b779

Please sign in to comment.