This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idist: xenial | |
language: bash | |
before_install: # Download and install Terraform for us on the container (v0.12.25) | |
- wget https://releases.hashicorp.com/terraform/0.12.25/terraform_0.12.25_linux_amd64.zip | |
- unzip terraform_0.12.25_linux_amd64.zip | |
- sudo mv terraform /usr/local/bin/ | |
- rm terraform_0.12.25_linux_amd64.zip | |
jobs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_user" "newemployees" { | |
count = length(var.iam_names) | |
name = element(var.iam_names,count.index) | |
path = "/system/" | |
tags = { | |
tag-key = "tag-value" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Five new employees user names | |
variable "iam_names" { | |
type = list | |
default = ["absmith", "bcjones","cdapple","kjohnson","tscott"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<h1>Level Up In Tech</h1> | |
<p> Learning it. Labbing it. Leveling Up</p> | |
<p>This is a simple static website, built and deliver from a docker container</p> | |
<p>Visit us here: <a href="https://levelupintech.com/">Level Up In Tech</a></p> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install nginx -y | |
COPY index.html /var/www/html/ | |
EXPOSE 80 | |
CMD ["nginx","-g","daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# variables.tf | |
variable "region" { | |
default = "us-east-1" | |
} | |
variable "profile" { | |
default = "default" | |
} | |
variable "public_instance" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# main.tf | |
# Input values for provider and create a VPC | |
provider "aws" { | |
region = var.region | |
profile = var.profile | |
} # end provider | |
# create the VPC | |
resource "aws_vpc" "My_VPC" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generating a private_key | |
resource "tls_private_key" "endptkey" { | |
algorithm = "RSA" | |
rsa_bits = 4096 | |
} | |
resource "local_file" "private-key" { | |
content = tls_private_key.endptkey.private_key_pem | |
filename = "endptkey.pem" #naming our key pair so that we can connect via ssh into our instances | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_role" "ec2_s3_access_role" { | |
name = "ec2-s3" | |
assume_role_policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "sts:AssumeRole", | |
"Principal": { | |
"Service": "ec2.amazonaws.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_vpc_endpoint" "s3" { | |
vpc_id = aws_vpc.My_VPC.id | |
service_name = "com.amazonaws.us-east-1.s3" | |
} | |
# associate route table with VPC endpoint | |
resource "aws_vpc_endpoint_route_table_association" "Private_route_table_association" { | |
route_table_id = aws_route_table.My_VPC_PRIVATE_route_table.id | |
vpc_endpoint_id = aws_vpc_endpoint.s3.id | |
} |
OlderNewer