This file contains hidden or 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
########################################## | |
# Retrieve the latest AMI id | |
########################################## | |
module "latest-ami" { | |
source = "./modules/ami-latest" | |
} | |
########################################## | |
# Initiate the temp files | |
########################################## |
This file contains hidden or 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
{ | |
"builders": [{ | |
"type": "amazon-ebs", | |
"ami_name": "${ami-name}-{{isotime \"Jan-02-06\"}}", | |
"instance_type": "${instance_type}", | |
"region": "${region}", | |
"source_ami": "${source_ami}", | |
"security_group_ids": ["${security_groups}"], | |
"ssh_username": "${ssh_username}", | |
"iam_instance_profile": "${instance_profile}", |
This file contains hidden or 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
stages: | |
- terraform | |
- packer | |
before_script: | |
- mkdir ~/.aws/ | |
- echo -e "[default]" > ~/.aws/credentials | |
- echo -e "aws_access_key_id=$AWS_ACCESS_KEY">> ~/.aws/credentials | |
- echo -e "aws_secret_access_key=$AWS_SECRET_KEY">> ~/.aws/credentials | |
- echo -e "[default]" > ~/.aws/config | |
- echo -e "region = us-east-1" >> ~/.aws/config |
This file contains hidden or 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
import json | |
import boto3 | |
import os | |
from botocore.vendored import requests | |
from base64 import b64decode | |
projectId = os.environ['projectId'] | |
token = os.environ['token'] | |
tokenDecrypted = boto3.client('kms').decrypt(CiphertextBlob=b64decode(token))['Plaintext'].decode("utf-8") |
This file contains hidden or 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 hashicorp/terraform:latest | |
RUN apk update && apk upgrade && apk add --no-cache \ | |
python3 \ | |
&& python3 -m ensurepip \ | |
&& pip3 install --upgrade pip setuptools \ | |
&& pip3 install awscli --upgrade --user \ | |
&& apk add bash \ | |
&& mv /root/.local/bin/* /usr/local/bin \ | |
&& rm -rf /var/cache/apk/* |
This file contains hidden or 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
variable "os" { | |
default = "linux" | |
validation { | |
# The condition here identifies if the variable contains the string "linxu" OR "windows". | |
condition = can(regex("linux|windows", var.os)) | |
error_message = "ERROR: Operating System must be Windows OR Linux." | |
} | |
} |
This file contains hidden or 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
### Test scenario for "can" | |
variable "word-length" { | |
validation { | |
# The condition here identifies if the integer if greater than 1 | |
condition = var.word-length > 1 | |
error_message = "The variable is not greater than 5. Word length has to be at a minimum > 1." | |
} | |
} |
This file contains hidden or 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
# Try example | |
data "http" "primary-server" { | |
url = "https://ip-ranges.amazonaws.com/ip-ranges.json" | |
# Optional request headers | |
request_headers = { | |
Accept = "application/json" | |
} | |
} |
This file contains hidden or 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
locals { | |
s3_ips = try(distinct([ #distinct() is not needed but added to showcase the wrap of functions before the loop | |
for items in jsondecode(data.http.primary-server.body).prefixes: | |
items.ip_prefix if items.service == "S3" | |
]), "NO LIST PROVIDED IN LOCALS S3_IPS VARIABLE") | |
} |
This file contains hidden or 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
{ | |
"basics": { | |
"name": "Karl Cardenas", | |
"label": "IT Architecture Manager/Leader", | |
"picture": "https://crazykarlcodes.dev/about/img/profile.jpg", | |
"email": "[email protected]", | |
"website": "https://crazykarlcodes.dev", | |
"summary": "I am a passionate technology leader with a strong emphasis on DevSecOps. I enjoy teaching others and enabling them to create business solutions. I believe in empowering others and leading by example. My strong technical background and unique leadership experience allows me to develop strong technical leaders and tackle challenging organizational problems others avoid. Attitude equal altitude.", | |
"location": { | |
"postalCode": "AZ 85257", |
OlderNewer