Skip to content

terraform

terraform #1

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: terraform
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "terraform" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.REGION }}
- name: Create s3 bucket
run: aws s3 mb s3://sockshop-terraform-state-bucket
- name: Install kubectl
uses: azure/setup-kubectl@v3
- name: Install helm
uses: azure/setup-helm@v4.2.0
- name: setup terraform
uses: hashicorp/setup-terraform@v2
- name: Create EKS cluster
run: |
terraform -chdir=terraform/ init
terraform -chdir=terraform apply --auto-approve
- name: Update kubeconfig
run: |
aws eks update-kubeconfig --region us-east-1 --name alameen-eks-cluster
kubectl create namespace sock-shop