GoogleContainerTools / GoogleContainerTools/skaffold
[Deploy] Add Terraform Deployer
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
I'm working on a Deployer implementation for [Terraform](https://www.terraform.io/) modules and would like to get early input for the design. Initial proposal follows. Questions and comments are highly encouraged!
# Skaffold Terraform Deployer
Uses `terraform` cli to deploy Kubernetes resources via Terraform module(s).
## Use Cases / Goals
- Rapid development of apps in an environment where Terraform is used significantly to manage Kubernetes clusters and resources.
- Infrastructure and environment details can be consumed from a remote Terraform state and incorporated in an app's development/deployment dynamically.
- Apps developed with Skaffold + Terraform Deployer can be tested and then released as Terraform modules for use in more complex Terraform environments.
## Design
### Scope
- I believe the Skaffold Terraform Deployer will be relatively simple, providing a thin layer of automation on top of simply running `terraform apply` and `terraform destroy` on one or more root modules.
- Terraform `modules`, and `variables` settings fed to said modules, would be the primary (only?) configurations available at the Skaffold level/config.
- Dynamic values managed by Skaffold like image tags would be passed into Terraform modules as variable inputs.
### Skaffold Config
Best represented with an example:
```yaml
deploy:
terraform:
modules:
- path: tf/module1
variables:
variable_name: value
- path: tf/module2
```
In the example above two Terraform modules backed by two separate Terraform states will be used by the Skaffold project. This config results in (roughly) the following CLI commands being run by Skaffold:
- `tf/module1`
```
terraform [apply|delete] -state=~/tf/states/module1/terraform.state -var 'variable_name=value' tf/module1
```
- `tf/module2`
```
terraform [apply|delete] -state=tf/module2/terraform.state tf/module2
```
Contributor guide
Assessment
This issue has not been assessed yet.