-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from rahuls512/three-tier-project
Created rds and stored username, password in github secret repo. and …
- Loading branch information
Showing
6 changed files
with
110 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- .github/workflows/build.yml | ||
- ../image-builder | ||
branches: [main] | ||
jobs: | ||
provision-three-tier: | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_key }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: setup the Packer | ||
id: setup | ||
uses: hashicorp/setup-packer@main | ||
|
||
- name: initialize packer | ||
id: initpacker | ||
run: "packer init ./image-builder/" | ||
|
||
- name: fmt packer | ||
id: fmtpacker | ||
run: "packer fmt ./image-builder/" | ||
|
||
- name: validate packer | ||
id: validate | ||
run: "packer validate ./image-builder/" | ||
|
||
- name: build image | ||
id: build | ||
run: "packer build ./image-builder/" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
############# RDS Instance ################################################################################################ | ||
resource "aws_db_instance" "default" { | ||
allocated_storage = 10 | ||
db_name = "threetierdb" | ||
engine = "mysql" | ||
engine_version = "8.0.32" | ||
instance_class = "db.t3.micro" | ||
username = var.db_user_name | ||
password = var.db_password | ||
skip_final_snapshot = true | ||
vpc_security_group_ids = [aws_security_group.db_sg.id] | ||
db_subnet_group_name = aws_db_subnet_group.this.id | ||
} | ||
############# RDS Instance Subnet Group ################################################################################################ | ||
resource "aws_db_subnet_group" "this" { | ||
name = "threetierdb_subnet_group" | ||
subnet_ids = [for each_subnet in aws_subnet.private_subnet : each_subnet.id] | ||
|
||
tags = { | ||
Name = "rsinfotech DB subnet group" | ||
} | ||
} |
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
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