-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6adf95f
commit 67381db
Showing
8 changed files
with
240 additions
and
154 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 |
---|---|---|
@@ -1,93 +1,93 @@ | ||
name: Terraform Plan Apply | ||
# name: Terraform Plan Apply | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
# on: | ||
# push: | ||
# pull_request: | ||
# workflow_dispatch: | ||
|
||
jobs: | ||
plan: | ||
name: "Run Terraform Plan" | ||
runs-on: ubuntu-20.04 | ||
# jobs: | ||
# plan: | ||
# name: "Run Terraform Plan" | ||
# runs-on: ubuntu-20.04 | ||
|
||
defaults: | ||
run: | ||
working-directory: . | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
# defaults: | ||
# run: | ||
# working-directory: . | ||
# steps: | ||
# - name: 'Checkout' | ||
# uses: actions/checkout@v2 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.3.9 | ||
terraform_wrapper: true | ||
# - name: Setup Terraform | ||
# uses: hashicorp/[email protected] | ||
# with: | ||
# terraform_version: 1.3.9 | ||
# terraform_wrapper: true | ||
|
||
- name: configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
# - name: configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v4 | ||
# with: | ||
# aws-region: us-east-2 | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
|
||
- name: Terraform Init | ||
id: init | ||
run: terraform init -no-color | ||
# - name: Terraform Init | ||
# id: init | ||
# run: terraform init -no-color | ||
|
||
- name: Create Artifact Folder | ||
shell: bash | ||
run: | | ||
sudo mkdir -p -m777 ${{ github.workspace }}/tfplanoutput | ||
# - name: Create Artifact Folder | ||
# shell: bash | ||
# run: | | ||
# sudo mkdir -p -m777 ${{ github.workspace }}/tfplanoutput | ||
|
||
- name: Terraform Plan | ||
id: plan | ||
run: | | ||
terraform plan -no-color -out=${{ github.workspace }}/tfplanoutput/tf.plan | ||
# - name: Terraform Plan | ||
# id: plan | ||
# run: | | ||
# terraform plan -no-color -out=${{ github.workspace }}/tfplanoutput/tf.plan | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ${{ github.workspace }}/tfplanoutput/ | ||
if-no-files-found: error | ||
# - name: Upload Artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: artifact | ||
# path: ${{ github.workspace }}/tfplanoutput/ | ||
# if-no-files-found: error | ||
|
||
apply: | ||
name: "Run Terraform Apply" | ||
needs: plan | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
# apply: | ||
# name: "Run Terraform Apply" | ||
# needs: plan | ||
# runs-on: ubuntu-20.04 | ||
# steps: | ||
# - name: 'Checkout' | ||
# uses: actions/checkout@v2 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.3.9 | ||
terraform_wrapper: true | ||
# - name: Setup Terraform | ||
# uses: hashicorp/[email protected] | ||
# with: | ||
# terraform_version: 1.3.9 | ||
# terraform_wrapper: true | ||
|
||
- name: configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
# - name: configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v4 | ||
# with: | ||
# aws-region: us-east-2 | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
|
||
- name: Terraform Init | ||
id: init | ||
run: terraform init -no-color | ||
# - name: Terraform Init | ||
# id: init | ||
# run: terraform init -no-color | ||
|
||
- name: Download Build Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ${{ github.workspace }}/tfplanoutput | ||
# - name: Download Build Artifact | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: artifact | ||
# path: ${{ github.workspace }}/tfplanoutput | ||
|
||
- name: Terraform Apply | ||
id: apply | ||
run: | | ||
terraform apply -no-color -input=false ${{ github.workspace }}/tfplanoutput/tf.plan | ||
# - name: Terraform Apply | ||
# id: apply | ||
# run: | | ||
# terraform apply -no-color -input=false ${{ github.workspace }}/tfplanoutput/tf.plan | ||
|
||
- name: Terraform Output | ||
id: output | ||
run: | | ||
terraform output | ||
# - name: Terraform Output | ||
# id: output | ||
# run: | | ||
# terraform output |
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 |
---|---|---|
@@ -1,92 +1,92 @@ | ||
# name: Terraform Plan Destroy | ||
name: Terraform Plan Destroy | ||
|
||
# on: | ||
# push: | ||
# workflow_dispatch: | ||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
# jobs: | ||
# plan: | ||
# name: "Run Terraform Plan" | ||
# runs-on: ubuntu-20.04 | ||
jobs: | ||
plan: | ||
name: "Run Terraform Plan" | ||
runs-on: ubuntu-20.04 | ||
|
||
# defaults: | ||
# run: | ||
# working-directory: . | ||
# steps: | ||
# - name: 'Checkout' | ||
# uses: actions/checkout@v2 | ||
defaults: | ||
run: | ||
working-directory: . | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
# - name: Setup Terraform | ||
# uses: hashicorp/[email protected] | ||
# with: | ||
# terraform_version: 1.3.9 | ||
# terraform_wrapper: true | ||
- name: Setup Terraform | ||
uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.3.9 | ||
terraform_wrapper: true | ||
|
||
# - name: configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v4 | ||
# with: | ||
# aws-region: us-east-2 | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
- name: configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
|
||
# - name: Terraform Init | ||
# id: init | ||
# run: terraform init -no-color | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init -no-color | ||
|
||
# - name: Create Artifact Folder | ||
# shell: bash | ||
# run: | | ||
# sudo mkdir -p -m777 ${{ github.workspace }}/tfplanoutput | ||
- name: Create Artifact Folder | ||
shell: bash | ||
run: | | ||
sudo mkdir -p -m777 ${{ github.workspace }}/tfplanoutput | ||
# - name: Terraform Plan | ||
# id: plan | ||
# run: | | ||
# terraform plan -destroy -no-color -out=${{ github.workspace }}/tfplanoutput/tf.plan | ||
- name: Terraform Plan | ||
id: plan | ||
run: | | ||
terraform plan -destroy -no-color -out=${{ github.workspace }}/tfplanoutput/tf.plan | ||
# - name: Upload Artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: artifact | ||
# path: ${{ github.workspace }}/tfplanoutput/ | ||
# if-no-files-found: error | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ${{ github.workspace }}/tfplanoutput/ | ||
if-no-files-found: error | ||
|
||
# apply: | ||
# name: "Run Terraform Apply" | ||
# needs: plan | ||
# runs-on: ubuntu-20.04 | ||
# steps: | ||
# - name: 'Checkout' | ||
# uses: actions/checkout@v2 | ||
apply: | ||
name: "Run Terraform Apply" | ||
needs: plan | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
# - name: Setup Terraform | ||
# uses: hashicorp/[email protected] | ||
# with: | ||
# terraform_version: 1.3.9 | ||
# terraform_wrapper: true | ||
- name: Setup Terraform | ||
uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.3.9 | ||
terraform_wrapper: true | ||
|
||
# - name: configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v4 | ||
# with: | ||
# aws-region: us-east-2 | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
- name: configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
|
||
# - name: Terraform Init | ||
# id: init | ||
# run: terraform init -no-color | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init -no-color | ||
|
||
# - name: Download Build Artifact | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: artifact | ||
# path: ${{ github.workspace }}/tfplanoutput | ||
- name: Download Build Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: ${{ github.workspace }}/tfplanoutput | ||
|
||
# - name: Terraform Apply | ||
# id: apply | ||
# run: | | ||
# terraform apply -no-color -input=false ${{ github.workspace }}/tfplanoutput/tf.plan | ||
- name: Terraform Apply | ||
id: apply | ||
run: | | ||
terraform apply -no-color -input=false ${{ github.workspace }}/tfplanoutput/tf.plan | ||
# - name: Terraform Output | ||
# id: output | ||
# run: | | ||
# terraform output | ||
- name: Terraform Output | ||
id: output | ||
run: | | ||
terraform output |
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 |
---|---|---|
@@ -1,23 +1,29 @@ | ||
import os | ||
import pymysql | ||
import time | ||
|
||
host = os.getenv('DB_HOST', 'localhost') | ||
user = os.getenv('DB_USER', 'admin') | ||
password = os.getenv('DB_PASSWORD', 'password') | ||
database = os.getenv('DB_NAME', 'mydb') | ||
|
||
connection = None | ||
try: | ||
# Connect to DB | ||
connection = pymysql.connect( | ||
host=host, | ||
user=user, | ||
password=password | ||
password=password, | ||
database=database | ||
) | ||
print(f"Connection to MySQL database successful! Hello World") | ||
time.sleep(40) | ||
|
||
except pymysql.MySQLError as e: | ||
print(f"Error connecting to MySQL database: {e}") | ||
time.sleep(40) | ||
finally: | ||
if connection: | ||
connection.close() | ||
print("Connection closed.") | ||
time.sleep(20) |
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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
Oops, something went wrong.