diff --git a/.github/workflows/tf_plan.yaml b/.github/workflows/tf_plan.yaml new file mode 100644 index 0000000..455bed6 --- /dev/null +++ b/.github/workflows/tf_plan.yaml @@ -0,0 +1,42 @@ + +name: 'Terraform Plan & Apply' + +on: + push: + branches: [ "test" ] + pull_request: + +jobs: + terraform: + name: 'Terraform' + runs-on: ubuntu-latest + + steps: + # Checkout the repository to the GitHub Actions runner + - name: Checkout + uses: actions/checkout@v3 + + - name: Configure AWS Credentials Action For GitHub Actions + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: Setup Terraform CLI + uses: hashicorp/setup-terraform@v2.0.2 + + + - name: Terraform Init & Dry Apply + run: | + cd dev-resources + echo "** Running Terraform Init**" + terraform init + + echo "** Running Terraform Validate**" + terraform validate + + echo "** Running Terraform Plan**" + terraform plan + + echo "** Running Terraform Dry Apply**" + terraform apply -auto-approve --dry-run diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e1caf97 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store + +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Kitchen files +**/inspec.lock +**/.kitchen +**/.kitchen.local.yml +**/Gemfile.lock + +# Ignore any .tfvars files that are generated automatically for each Terraform +# run. Most .tfvars files are managed as part of configuration and so should be +# included in version control. +# +# example.tfvars +**/terraform.tfvars diff --git a/dev-resources/backend.tf b/dev-resources/backend.tf new file mode 100644 index 0000000..9371943 --- /dev/null +++ b/dev-resources/backend.tf @@ -0,0 +1,6 @@ +terraform { + backend "s3" { + bucket = "iac-devops-playground" + region = "us-east-1" + } +} diff --git a/dev-resources/main.tf b/dev-resources/main.tf new file mode 100644 index 0000000..a8bbffb --- /dev/null +++ b/dev-resources/main.tf @@ -0,0 +1,3 @@ +module "dev_load_balancer" { + source = "./AWS Module/Load Balancer" +} \ No newline at end of file diff --git a/dev-resources/provider.tf b/dev-resources/provider.tf new file mode 100644 index 0000000..e123d7a --- /dev/null +++ b/dev-resources/provider.tf @@ -0,0 +1,3 @@ +provider "aws" { + region = "us-east-1" +}