Skip to content

Commit

Permalink
initial iac
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerthome committed Aug 2, 2023
1 parent a25ba67 commit c2ef934
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy-iac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
jobs:
provision-ec2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: '${{ secrets.TERRAFORM_AWS_KEY }}'
aws-secret-access-key: '${{ secrets.TERRAFORM_AWS_SECRET }}'
aws-region: us-east-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Terraform Apply
id: apply
env:
TF_VAR_ec2_name: "homeuniteus-ec2"
run: |
cd iac/
terraform fmt -recursive .
terraform init
terraform validate
terraform plan
terraform apply -auto-approve
23 changes: 23 additions & 0 deletions .github/workflows/generate-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
tags:
- 'v*'
name: Generate Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Release generated from ${{ github.ref }}
draft: false
prerelease: false
19 changes: 19 additions & 0 deletions iac/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "aws_route53_zone" "main" {
name = "homeunite.us"
}

resource "aws_route53_zone" "dev" {
name = "dev.homeunite.us"

tags = {
Environment = "dev"
}
}

resource "aws_route53_record" "dev-ns" {
zone_id = aws_route53_zone.main.zone_id
name = "dev.homeunite.us"
type = "NS"
ttl = "30"
records = aws_route53_zone.dev.name_servers
}

0 comments on commit c2ef934

Please sign in to comment.