# terraform-spark-royalties

This repo is using terraform 0.12 because 0.11 doesn't allow `"default = null"` for variables

## Bringing Up the EMR Cluster

When applying changes, make sure to first `cd` into the appropriate directory ("qa" or "prod")

Init:
```bash
$ terraform init
```

Plan:
```bash
$ terraform plan
```

If the plan looks good, apply:
```bash
$ terraform apply
```

**Note:** As of this writing, there is an ordering issue in `./qa/main.tf`:
the `emr` module needs S3 access *before* bootstrapping, but the S3 access is attached after.
Worst case scenario, terraform changes may need to be applied *twice*.

## Tearing Down the EMR Cluster

To tear down the existing EMR cluster without also destroying roles, policies, or security groups, target the cluster using:
```bash
terraform destroy -target module.emr.aws_security_group.emr_cluster
```
