Skip to content

Instantly share code, notes, and snippets.

View bmwitcher's full-sized avatar

Bryant Witcher bmwitcher

View GitHub Profile
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:
resource "aws_iam_user" "newemployees" {
count = length(var.iam_names)
name = element(var.iam_names,count.index)
path = "/system/"
tags = {
tag-key = "tag-value"
}
}
#Five new employees user names
variable "iam_names" {
type = list
default = ["absmith", "bcjones","cdapple","kjohnson","tscott"]
}
<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>
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;"]
@bmwitcher
bmwitcher / variables.tf
Created October 19, 2020 21:15
vpc end var
# variables.tf
variable "region" {
default = "us-east-1"
}
variable "profile" {
default = "default"
}
variable "public_instance" {
@bmwitcher
bmwitcher / main.tf
Created October 19, 2020 21:19
main file from tf vpc end point lab
# 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" {
@bmwitcher
bmwitcher / createmachines.tf
Created October 19, 2020 21:23
creating instances and keypair for vpc endpoint lab
# 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
}
@bmwitcher
bmwitcher / ec2iam.tf
Created October 19, 2020 21:24
creating iam roles, polcies, and attachemts for vpc endpoint lab
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"
@bmwitcher
bmwitcher / vpc_endpoint.tf
Created October 19, 2020 21:25
creating and attaching endpoints for vpc endpoint lab
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
}