Skip to content

Commit d957d2d

Browse files
committed
Create terraform container
1 parent 1c7be6e commit d957d2d

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Pycharm
2+
.idea/
3+
4+
# Terraform
5+
.terraform/
6+
7+
# Ensure mapped env_vars are never committed
8+
env_vars.ini

Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Create docker container with Terraform installed, and suite of tools to ease working with AWS
2+
FROM ubuntu:19.04
3+
4+
ENV TERRAFORM_VERSION 0.12.6
5+
ENV TERRAFORM_URL https://releases.hashicorp.com/terraform/$TERRAFORM_VERSION/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
6+
7+
# Install dependencies
8+
RUN apt-get update && apt-get install -y \
9+
dos2unix \
10+
curl \
11+
git-core \
12+
python3-pip \
13+
vim \
14+
zip
15+
16+
# Set python aliases for python3 and upgrade pip
17+
RUN echo 'alias python=python3' >> ~/.bashrc
18+
RUN echo 'alias pip=pip3' >> ~/.bashrc
19+
RUN pip3 install --upgrade pip
20+
21+
# Install python dependencies
22+
RUN pip3 install awscli
23+
24+
# Install Terraform
25+
RUN curl -o /root/terraform.zip $TERRAFORM_URL && \
26+
unzip /root/terraform.zip -d /usr/local/bin/ && \
27+
rm /root/terraform.zip

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
# foss4g-serverless-ops
22
Repo containing Terraform scripts for spinning up AWS serverless environment
3+
4+
#### Running the Container
5+
The container can be run as follows, once logged in you MUST run the ```setenv.sh``` to ensure environment is set up correctly
6+
7+
```bash
8+
docker-compose run foss4g-ops
9+
cd ops
10+
. ./setenv.sh
11+
```
12+
13+
## TODO
14+
15+
* Explain setting up AWS credentials
16+
* Setup an S3 bucket to hold Terraform State

docker-compose.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Docker compose file that sets up environment:
2+
# Maps local ops directory to ops within the container, allowing us to make local changes and run immediately
3+
# Maps local docker.aws directory this is where necessary credentials can live outside of git
4+
# Creates image called foss4g_ops
5+
version: "3"
6+
7+
services:
8+
foss4g-ops:
9+
build:
10+
context: .
11+
dockerfile: Dockerfile
12+
image: foss4g_ops
13+
volumes:
14+
- ./ops:/ops
15+
- ../docker.aws:/root/.aws
16+
- ../docker.aws/env_vars.ini:/ops/utils/env_vars.ini

ops/setenv.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
# Setup global params. Must be run prior negotiating with AWS
3+
# Run as follows:
4+
# . ./setenv.sh
5+
6+
# Override defaults if desired
7+
REGION="us-east-1"
8+
PROFILE="foss4g_ops"
9+
BUCKET="foss4g-ops-tfstate"

0 commit comments

Comments
 (0)