Skip to content

Commit

Permalink
Add types to variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmacedot committed Oct 30, 2023
1 parent 7514c68 commit b397bff
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 3 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Lint

on: [push]

permissions: read-all

jobs:
tflint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: TFLint
uses: docker://wata727/tflint

fmt:
name: Code Format
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- uses: actions/checkout@master
- run: terraform fmt --recursive -check=true

validate:
name: Validate
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- uses: actions/checkout@master
- name: Validate Code
env:
AWS_REGION: "us-east-1"
TF_WARN_OUTPUT_ERRORS: 1
TF_VAR_vpc_id: "vpc-123456"
TF_VAR_subnets: '["subnet-12345a"]'
TF_VAR_workers_ami_id: "ami-123456"
TF_VAR_cluster_name: "test_cluster"
run: |
terraform init
terraform validate
- name: Validate Examples
run: |
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
cd $example
terraform init
terraform validate
cd -
done
minimum:
name: Minimum version check
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:0.13.0
steps:
- uses: actions/checkout@master
- name: Validate Code
env:
AWS_REGION: "us-east-1"
TF_WARN_OUTPUT_ERRORS: 1
run: |
sed -i -e 's/>=/=/' -e 's/ \(\d\+\.\d\+\)"/ \1.0"/' versions.tf
terraform init
terraform validate -var "region=${AWS_REGION}" -var "vpc_id=vpc-123456" -var "subnets=[\"subnet-12345a\"]" -var "workers_ami_id=ami-123456" -var "cluster_ingress_cidrs=[]" -var "cluster_name=test_cluster"
13 changes: 10 additions & 3 deletions _variables.tf
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
variable "enabled" {
description = "The boolean flag whether this module is enabled or not. No resources are created when set to false."
type = bool
default = true
}

variable "lambda_name" {
description = "The name of the lambda which will be notified with a custom message when any alarm is performed."
type = string
default = "lambda_alarm_notification"
}

variable "cloudtrail_log_group_name" {
description = "The name of the loggroup that will get information from"
type = string
}

variable "lambda_timeout" {
description = "Set lambda Timeout"
default = 3
type = number
default = 3
}

variable "sns_topic_name" {
description = "The name of the SNS Topic which will be notified when any alarm is performed."
type = string
default = "CISAlarmV2"
}
}

variable "alarm_account_ids" {
default = []
type = list(string)
}

variable "alarm_mode" {
default = "light"
type = string
description = "Version of alarms to use. 'light' or 'full' available"
}

variable "tags" {
description = "Specifies object tags key and value. This applies to all resources created by this module."
type = map(string)
default = {
"Terraform" = true
}
}

0 comments on commit b397bff

Please sign in to comment.