diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e69de29..0a59695 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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" diff --git a/_variables.tf b/_variables.tf index 8c10b24..4302ba3 100644 --- a/_variables.tf +++ b/_variables.tf @@ -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 } } -