Skip to content

Commit

Permalink
added services and upgraded insance type
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwembo committed Apr 12, 2024
1 parent 2eb77d4 commit 5d68802
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 83 deletions.
166 changes: 83 additions & 83 deletions .github/workflows/terraform-aws-ec2-4.yaml
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
# name: "Terraform Pipeline Provision EC2"
name: "Terraform Pipeline Provision EC2"

# on:
# push:
# branches: ['master' , 'main']
# pull_request:
# branches: ['master', 'main']
on:
push:
branches: ['master' , 'main']
pull_request:
branches: ['master', 'main']

# permissions:
# contents: write
permissions:
contents: write

# env:
# # verbosity setting for Terraform logs
# TF_LOG: INFO
# # Credentials for deployment to AWS
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# TF_CLOUD_ORGANIZATION: "prodxcloud"
# TF_WORKSPACE: "prodxcloud"
# TF_API_TOKEN: ${{ secrets.TF_API_TOKEN}}
# CONFIG_DIRECTORY: "./deployments/terraform/terraform-aws-ec2-tf/terraform/"
env:
# verbosity setting for Terraform logs
TF_LOG: INFO
# Credentials for deployment to AWS
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_CLOUD_ORGANIZATION: "prodxcloud"
TF_WORKSPACE: "prodxcloud"
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN}}
CONFIG_DIRECTORY: "./deployments/terraform/terraform-aws-ec2-tf/terraform/"


# jobs:
# terraform:
# name: "Terraform Pipeline Provision EC2 with S3 Bucket"
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# # We keep Terraform files in the terraform directory.
# working-directory: ./deployments/terraform/terraform-aws-ec2-tf/terraform
jobs:
terraform:
name: "Terraform Pipeline Provision EC2 with S3 Bucket"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
# We keep Terraform files in the terraform directory.
working-directory: ./deployments/terraform/terraform-aws-ec2-tf/terraform

# steps:
# - name: Checkout the repository to the runner
# uses: actions/checkout@v2
steps:
- name: Checkout the repository to the runner
uses: actions/checkout@v2

# - name: Setup Terraform with specified version on the runner
# uses: hashicorp/setup-terraform@v2
# with:
# terraform_version: 1.3.0
- name: Setup Terraform with specified version on the runner
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.0

# - name: Terraform init
# id: init
# run: terraform init -lock=false
# # env:
# # TF_CLI_ARGS_init: '-backend-config="token=${{ secrets.TF_API_TOKEN }}"'
- name: Terraform init
id: init
run: terraform init -lock=false
# env:
# TF_CLI_ARGS_init: '-backend-config="token=${{ secrets.TF_API_TOKEN }}"'

# - name: Terraform format
# id: fmt
# run: terraform fmt
- name: Terraform format
id: fmt
run: terraform fmt

# - name: Terraform validate
# id: validate
# run: terraform validate
# env:
# GITHUB_TOKEN: ${{ secrets.G_TOKEN}}
# TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}
- name: Terraform validate
id: validate
run: terraform validate
env:
GITHUB_TOKEN: ${{ secrets.G_TOKEN}}
TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}

# # - uses: actions/github-script@v6
# # # if: github.event_name == 'pull_request'
# # env:
# # PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
# # with:
# # script: |
# # const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
# # #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
# # #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
# # #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
# - uses: actions/github-script@v6
# # if: github.event_name == 'pull_request'
# env:
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
# with:
# script: |
# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
# #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
# #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
# #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`

# # <details><summary>Show Plan</summary>
# <details><summary>Show Plan</summary>

# # \`\`\`\n
# # ${process.env.PLAN}
# # \`\`\`
# \`\`\`\n
# ${process.env.PLAN}
# \`\`\`

# # </details>
# # *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
# </details>
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;

# # github.rest.issues.createComment({
# # issue_number: context.issue.number,
# # owner: context.repo.owner,
# # repo: context.repo.repo,
# # body: output
# # })
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: output
# })

# # - name: Terraform Plan Status
# # if: steps.plan.outcome == 'failure'
# # run: exit 1
# - name: Terraform Plan Status
# if: steps.plan.outcome == 'failure'
# run: exit 1

# - name: Terraform Apply
# # if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# run: terraform apply -auto-approve -input=false -lock=false
# # env:
# # TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Apply
# if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false -lock=false
# env:
# TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}

# # - name: Terraform Destroy All Resources
# # # if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# # run: terraform destroy -auto-approve -input=false -lock=false
# # env:
# # TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}
# - name: Terraform Destroy All Resources
# # if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# run: terraform destroy -auto-approve -input=false -lock=false
# env:
# TFE_TOKEN: ${{ secrets.TF_API_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ variable "ingress_rules" {
"to_port" = "8585"
"protocol" = "tcp"
"cidr_blocks" = ["0.0.0.0/0"]
},
"Django alt Application port" = {
"description" = "For Django alt port"
"from_port" = "8000"
"to_port" = "8000"
"protocol" = "tcp"
"cidr_blocks" = ["0.0.0.0/0"]
}

"All Ports" = {
Expand Down

0 comments on commit 5d68802

Please sign in to comment.