Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/terr_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Terraform-infra"

on:
push:
branches:
- infra_branch
- main
workflow_dispatch:

jobs:
terraform:
name: "Terraform"
runs-on: Ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
REGION: 'us-east-1'

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Terraform setup
uses: hashicorp/setup-terraform@v1

- name: Terraform init
id: init
run: terraform init

- name: Terraform plan
id: plan
if: github.event_name == 'push'
run: terraform plan -no-color

- name: Terraform plan status
if: steps.plan.outcome == 'failure'
run: exit 1

- name: Terraform apply
id: apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve
23 changes: 23 additions & 0 deletions ifra.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

# Configure the AWS Provide
provider "aws" {
region = "us-east-1"
}

resource "aws_instance" "toto" {
ami = "ami-0a0e5d9c7acc336f1"
instance_type = "t2.micro"
security_groups = ["SG-Jenkins"]
key_name = "my"
}
data "aws_vpc" "default" {
default = true
}