Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/displague/linode-terraform-demo
Docker image to demo the Linode Terraform Provider
https://github.com/displague/linode-terraform-demo
Last synced: 8 days ago
JSON representation
Docker image to demo the Linode Terraform Provider
- Host: GitHub
- URL: https://github.com/displague/linode-terraform-demo
- Owner: displague
- Created: 2018-10-10T21:15:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-11T00:33:56.000Z (about 6 years ago)
- Last Synced: 2024-12-13T06:35:14.887Z (10 days ago)
- Language: HCL
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Linode Terraform Provider in a Container
This repository contains a `Dockerfile` and a basic set of Terraform configuration files that demonstrate the Linode Terraform Provider.
The image is based on the `hashicorp/terraform:full` image, adding only the Linode provider.
Terraform variables can be defined in config files, using the command-line, or using environment variables. For the purposes of this demo container, environment variables will be supplied through `docker -e` arguments. We will also attach the local copy of this repository to the container.
### Name the Container
```bash
DOCKER_IMAGE=displague/linode-terraform-demo
```### Build the Container (Optional)
```bash
docker build . -t $DOCKER_IMAGE
```### Setup the Environment for the Container
```bash
read -sp "Linode Token: " LINODE_TOKEN; echo
export TF_VAR_root_pass="$(openssl rand -base64 32)"
export TF_VAR_authorized_key="$(cat ~/.ssh/id_rsa.pub)"
export TF_VAR_linode_token="$LINODE_TOKEN"
```### Run the Container
Finally, let's run terraform from the container.
```bash
alias dockertf='docker run -v `pwd`/:/terraform -it -e TF_VAR_root_pass="$TF_VAR_root_pass" -e TF_VAR_authorized_key="$TF_VAR_authorized_key" -e TF_VAR_linode_token="$TF_VAR_linode_token" $DOCKER_IMAGE'
dockertf plan
dockertf apply
```You will notice that `.terraform` now contains more files.
#### Destroy the created Linode Instances
```bash
dockertf destroy
```### Enter the Container
To dive deeper into this demo,
```bash
docker run -it --entrypoint /bin/bash displague/linode-terraform-demo
```