Skip to content

Commit

Permalink
add action and oidc integration
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerthome committed Jun 27, 2024
1 parent 7330ba0 commit eac5e80
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/terraform-plan-with-oidc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Terraform deploy with OIDC
on:
workflow_dispatch:
inputs:
target-host-environment:
type: choice
description: The AWS environment to deploy (dev/test/prod)
options:
- dev
- test
- prod

permissions:
id-token: write
contents: read

jobs:

TerraformPlan:

runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::035866691871:role/gha-incubator
role-session-name: ghaincubatorsession
aws-region: us-west-2

- name:
uses: hashicorp/setup-terraform@v3

- name: Run terraform
run: |
pushd ./terraform-incubator/home-unite-us
terraform init
popd
21 changes: 20 additions & 1 deletion terraform-incubator/home-unite-us/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,23 @@ resource "aws_route53_record" "www" {
type = "A"
ttl = 300
records = ["18.223.160.58"]
}
}

terraform {

required_providers {
aws = {
source = "hashicorp/aws"
}
}

backend "s3" {
region = "us-west-2"
key = "incubator/home-unite-us/dev.tfstate"
bucket = "hlfa-incubator-terragrunt"
}
}

provider "aws" {
region = "us-west-2"
}

0 comments on commit eac5e80

Please sign in to comment.