Skip to content

Commit

Permalink
enha: added variable validations
Browse files Browse the repository at this point in the history
  • Loading branch information
kfc-manager committed Apr 5, 2024
1 parent 9be0e53 commit fa85ad4
Show file tree
Hide file tree
Showing 10 changed files with 485 additions and 229 deletions.
Binary file removed .github/diagrams/cluster-dark.png
Binary file not shown.
Binary file removed .github/diagrams/cluster-light.png
Binary file not shown.
Binary file removed .github/diagrams/cluster-transparent.png
Binary file not shown.
90 changes: 0 additions & 90 deletions .github/diagrams/cluster.drawio

This file was deleted.

119 changes: 0 additions & 119 deletions README.md

This file was deleted.

6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ resource "aws_eks_node_group" "main" {
subnet_ids = var.node_groups[count.index]["subnets"]

launch_template {
id = var.node_groups[count.index]["launch_template"]["id"]
version = var.node_groups[count.index]["launch_template"]["version"]
id = var.node_groups[count.index]["launch_template"]
version = "$Latest"
}

scaling_config {
Expand Down Expand Up @@ -205,6 +205,8 @@ resource "aws_iam_role" "main" {
count = length(var.service_accounts)
assume_role_policy = data.aws_iam_policy_document.main[count.index].json
name = var.service_accounts[count.index]["iam_role_name"]

tags = var.tags
}

# map each policy to it's role from tree like objects
Expand Down
28 changes: 28 additions & 0 deletions tests/cluster.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
provider "aws" {
region = "eu-central-1"
default_tags {
tags = {
Environment = "Test"
}
}
}

run "invalid_identifier" {
command = plan

variables {
identifier = "ab"
subnets = ["subnet-"]
}

expect_failures = [var.identifier]
}

run "valid_identifier" {
command = plan

variables {
identifier = "abc"
subnets = ["subnet-"]
}
}
Loading

0 comments on commit fa85ad4

Please sign in to comment.