Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh actions2 #2

Merged
merged 18 commits into from
Aug 12, 2024
22 changes: 22 additions & 0 deletions .github/workflows/tf-fmt-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: tfactions
on:
push:
branches:
- main
pull_request:
jobs:
tfactions:
name: tfactions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
soft_fail: true

- name: Terraform fmt
id: fmt
run: terraform fmt -check
23 changes: 18 additions & 5 deletions .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@ on:
pull_request:
jobs:
tfsec:
name: tfsec
name: tfsec sarif report
runs-on: ubuntu-latest

permissions:
actions: read
contents: read
security-events: write
steps:
- name: Clone repo
uses: actions/checkout@master
uses: actions/checkout@v2
with:
persist-credentials: false

- name: tfsec
uses: aquasecurity/[email protected]
uses: aquasecurity/[email protected]
with:
sarif_file: tfsec.sarif
additional_args: '--severity HIGH'

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v1
with:
soft_fail: true
# Path to SARIF file relative to the root of the repository
sarif_file: tfsec.sarif
25 changes: 25 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,0 +1,7 @@
resource "aws_s3_bucket" "my_bucket" {
bucket = "test-bucket-42353242213123"
tags = {
Name = "MyS3Bucket"
Environment = "Dev"
}
}
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
2 changes: 1 addition & 1 deletion provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ provider "aws" {
allowed_account_ids = [var.aws_account]

assume_role {
role_arn = "arn:aws:iam::${var.aws_account}:role/svc_terraform"
role_arn = "arn:aws:iam::${var.aws_account}:role/terraform-service"
session_name = "Terraform"
}

Expand Down
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "name" {
type = string
}

variable "region" {
description = "AWS region to create resources in"
type = string
default = "us-east-1"
}

variable "aws_account" {
description = "Account number to create AWS resources in. This variable should be defined in the Terraform Cloud workspace settings"
}
Loading