Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lolli001 committed Aug 1, 2024
1 parent 5de10c9 commit e8a6c43
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
24 changes: 5 additions & 19 deletions build.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@ variable "project_name" {
}

variable "ansible_dir" {
type = string
type = string
default = "aws-image-pipeline"
}

source "amazon-ebs" "rhel" {
ami_name = "${var.project_name}-{{timestamp}}"
instance_type = "t3.micro" # Instance type supporting x86_64
instance_type = "t3.micro"
region = "us-gov-west-1"
source_ami = "ami-03fadeeea589a106b" # Updated AMI ID for RHEL x86_64
source_ami = "ami-03fadeeea589a106b"
ssh_username = "ec2-user"

# Set environment variables for proxy
user_data = <<EOF
#!/bin/bash
export http_proxy=http://proxy.tco.census.gov:3128
export https_proxy=http://proxy.tco.census.gov:3128
export no_proxy=.census.gov,169.254.169.254,148.129.*,10.*,172.18.*,172.22.*,172.23.*,172.24.*,172.25.*,.eks.amazonaws.com,.s3.amazonaws.com,.amazonaws.com,.gcr.io,.pkg.dev,us-gov-west-1.compute.internal,.us-gov-west-1.compute.internal
EOF
profile = "229685449397-csvd-dev-gov.inf-admin-t2"
}

build {
Expand All @@ -31,20 +25,12 @@ build {
"export http_proxy=http://proxy.tco.census.gov:3128",
"export https_proxy=http://proxy.tco.census.gov:3128",
"export no_proxy=.census.gov,169.254.169.254,148.129.*,10.*,172.18.*,172.22.*,172.23.*,172.24.*,172.25.*,.eks.amazonaws.com,.s3.amazonaws.com,.amazonaws.com,.gcr.io,.pkg.dev,us-gov-west-1.compute.internal,.us-gov-west-1.compute.internal",
"yum -y install epel-release",
"yum -y install python3-pip",
"pip3 install --trusted-host pypi.org --trusted-host files.pythonhosted.org --proxy=$http_proxy passlib"
]
}

provisioner "ansible" {
playbook_file = "${var.ansible_dir}/rhel-arm-baseline.yaml"
extra_arguments = ["-e", "ansible_python_interpreter=/usr/bin/python3"]
environment_vars = {
HTTP_PROXY = "http://proxy.tco.census.gov:3128"
HTTPS_PROXY = "http://proxy.tco.census.gov:3128"
NO_PROXY = ".census.gov,169.254.169.254,148.129.*,10.*,172.18.*,172.22.*,172.23.*,172.24.*,172.25.*,.eks.amazonaws.com,.s3.amazonaws.com,.amazonaws.com,.gcr.io,.pkg.dev,us-gov-west-1.compute.internal,.us-gov-west-1.compute.internal"
}
}

post-processor "shell-local" {
Expand Down
26 changes: 26 additions & 0 deletions vpc.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
provider "aws" {
region = "us-gov-west-1"
profile = "229685449397-csvd-dev-gov.inf-admin-t2"
}

# Create a VPC
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true

tags = {
Name = "main-vpc"
}
}

# Create a Subnet
resource "aws_subnet" "main" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-gov-west-1a"

tags = {
Name = "main-subnet"
}
}

0 comments on commit e8a6c43

Please sign in to comment.