# terraform-video
Infrastructure as code for video encoding pipeline and tools.

## Get Started
1. Clone this repo
2. Add your own `terraform.tfvars` file under the specific environment you are
provisioning, i.e. `prod`, `qa`, `dev`. This file will not be added to version
control.
3. Fill out values for variables you currently know. `DB_HOST` will
only be known after you've run `ows_video_rds` module.
4. Run the following terraform steps:
    1. For setting up dev: change the variable `CHANGE_ME_VIDEO_USER` to the actual username
     you plan to use throughout the recipe, i.e. `AWS_USERNAME`.
    2. `terraform plan`
    3. `terraform apply -target module.ows_video_rds`
    4. Run `terraform output -module=ows_video_rds` then get the output for rds
    cluster endpoint. Create a new variable in `terraform.tfvars` for `DB_HOST` with the
    database url from the `terraform output` command run above.
    5. `terraform plan -target module.ows_video_service_environment`
    6. `terraform apply -target module.ows_video_service_environment`
    7. `terraform plan -target module.daemon_video_service_environment`
    8. `terraform apply -target module.daemon_video_service_environment`

## Known Issues
The terraform elastic beanstalk module accepts settings for environment variables
a `list` of `dicts`. All values within key/value pairs must be static.
Values cannot be dynamically computed outputs from modules due to a limitation
in the way the Terraform DSL works. Thus we must run our recipe with specific
targets and cannot simply use *all* module outputs within subsequent modules.
This works for other modules such as terraform-lambda.
