Skip to content

Commit

Permalink
Merge pull request #3 from omers/terraform-action
Browse files Browse the repository at this point in the history
Terraform action
  • Loading branch information
omers authored Jul 2, 2023
2 parents e43f1a9 + 16a94eb commit 8e0f52d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Terraform'

on:
push:
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
environment: production

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash

steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1

# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init

- name: Terraform Validate
run: terraform validate
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ variable "environment" {
variable "region" {
type = string
description = "AWS Region"
validation {
condition = can(regex("[a-z][a-z]-[a-z]+-[1-9]", var.region))
error_message = "Must be valid AWS Region names."
}
}

variable "emails" {
Expand Down

0 comments on commit 8e0f52d

Please sign in to comment.