The Terraform plugin applies the infrastructure configuration contained within the repository. The below pipeline configuration demonstrates simple usage:
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`:
```yaml
pipeline:
terraform:
image: jmccann/drone-terraform:1
plan: false
image: jmccann/drone-terraform:5
```
Example configuration passing `vars` to terraform commands:
@ -22,13 +21,23 @@ Example configuration passing `vars` to terraform commands:
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:1
plan: false
image: jmccann/drone-terraform:5
+ vars:
+ app_name: my-project
+ app_version: 1.0.0
```
Example of explicitly specifying `actions` to perform a dry run.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:5
+ actions:
+ - validate
+ - plan
```
Example configuration passing secrets to terraform. Please read
@ -142,8 +144,7 @@ and you want to use different drone configurations to apply different environmen
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:1
plan: false
image: jmccann/drone-terraform:5
+ root_dir: some/path/here
```
@ -154,8 +155,7 @@ all resources will be planned/applied against as the default behavior.
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:1
plan: false
image: jmccann/drone-terraform:5
+ targets:
+ - aws_security_group.generic_sg
+ - aws_security_group.app_sg
@ -167,25 +167,26 @@ If you want to change Terraform's default parallelism (currently equal to 10) th
```diff
pipeline:
terraform:
image: jmccann/drone-terraform:1
plan: false
image: jmccann/drone-terraform:5
+ parallelism: 2
```
Destroying the service can be done using the boolean `destory` option. Keep in mind that Fastly won't allow a service with active version be destoryed. Use `force_destroy` option in the service definition for terraform to handle it.
Destroying the service can be done by specifying `plan-destroy` and `destroy` actions. Keep in mind that Fastly won't allow a service with active version be destroyed. Use `force_destroy` option in the service definition for terraform to handle it.
```yaml
pipeline:
destroy:
image: jmccann/drone-terraform:1
plan: false
+ destroy: true
image: jmccann/drone-terraform:5
+ actions:
+ - plan-destroy
+ - destroy
```
# Parameter Reference
plan
: if true, calculates a plan but does __NOT__ apply it.
actions
: List of terraform actions to perform with the plugin. List includes:
: contains the configuration for the Terraform backend.
@ -223,6 +224,3 @@ root_dir
parallelism
: The number of concurrent operations as Terraform walks its graph.
destroy (boolean)
: Destroys the service (still requires [`force_destroy`](https://www.terraform.io/docs/providers/fastly/r/service_v1.html#force_destroy) option to be set in the service definition)