From 2f2ffb00b4b3b285cd154576bf01dee4542e8b8e Mon Sep 17 00:00:00 2001 From: arnol377 Date: Mon, 14 Apr 2025 15:34:49 -0400 Subject: [PATCH] updating --- .gitignore | 1 + basic.tftest.hcl | 45 -------------- .../default/modules/github_repo | 2 +- .../default/modules/modules.json | 2 +- validation.tftest.hcl.tmp | 62 ------------------- workflow_trigger.tftest.hcl | 40 ------------ workflow_trigger.tftest.hcl.tmp | 40 ------------ 7 files changed, 3 insertions(+), 189 deletions(-) delete mode 100644 basic.tftest.hcl delete mode 100644 validation.tftest.hcl.tmp delete mode 100644 workflow_trigger.tftest.hcl delete mode 100644 workflow_trigger.tftest.hcl.tmp diff --git a/.gitignore b/.gitignore index 6862aed..e9b6656 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ terraform.rc # Ignore test temporary files *.tftest.hcl.tmp +terraform_data_dirs diff --git a/basic.tftest.hcl b/basic.tftest.hcl deleted file mode 100644 index 1036299..0000000 --- a/basic.tftest.hcl +++ /dev/null @@ -1,45 +0,0 @@ -variables { - name = "test-eks-cluster" - organization = "SCT-Engineering" - template_repo_org = "SCT-Engineering" - environment = "dev" - region = "us-gov-east-1" - github_server_url = "https://github.e.it.census.gov" - cluster_config = { - cluster_name = "dev-eks-01" - account_name = "dev-account" - aws_account_id = "123456789012" - aws_profile = "dev-profile" - environment_abbr = "dev" - vpc_name = "dev-vpc" - vpc_domain_name = "dev.example.com" - } - enable_modules = { - cert_manager = true - prometheus = true - grafana = true - } -} - -provider "github" { - base_url = var.github_server_url -} - -run "verify_repository_config" { - command = apply - - assert { - condition = module.github_repo.github_repo.name == var.name - error_message = "Repository name does not match expected value" - } - - assert { - condition = contains(module.github_repo.github_repo.topics, "eks") - error_message = "Repository topics should include 'eks'" - } - - assert { - condition = module.github_repo.github_repo.visibility == "private" - error_message = "Repository visibility should be private" - } -} \ No newline at end of file diff --git a/terraform_data_dirs/default/modules/github_repo b/terraform_data_dirs/default/modules/github_repo index b6b6cba..6140ffe 160000 --- a/terraform_data_dirs/default/modules/github_repo +++ b/terraform_data_dirs/default/modules/github_repo @@ -1 +1 @@ -Subproject commit b6b6cba8c08f2997b7a4058c421d41744ef7793d +Subproject commit 6140ffe240ed0a9b1ff42940238a9ea7348db255 diff --git a/terraform_data_dirs/default/modules/modules.json b/terraform_data_dirs/default/modules/modules.json index a03d773..89ced5d 100644 --- a/terraform_data_dirs/default/modules/modules.json +++ b/terraform_data_dirs/default/modules/modules.json @@ -1 +1 @@ -{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"github_repo","Source":"registry.terraform.io/HappyPathway/repo/github","Version":"1.0.83","Dir":"/data/terraform/workspaces/arnol377/git/terraform-eks-deployment/terraform_data_dirs/default/modules/github_repo"}]} \ No newline at end of file +{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"github_repo","Source":"registry.terraform.io/HappyPathway/repo/github","Version":"1.0.84","Dir":"/data/terraform/workspaces/arnol377/git/terraform-eks-deployment/terraform_data_dirs/default/modules/github_repo"}]} \ No newline at end of file diff --git a/validation.tftest.hcl.tmp b/validation.tftest.hcl.tmp deleted file mode 100644 index e609b16..0000000 --- a/validation.tftest.hcl.tmp +++ /dev/null @@ -1,62 +0,0 @@ -variables { - name = "test-eks-cluster" - organization = "test-org" - template_repo_org = "test-org" - environment = "dev" - region = "us-east-1" - github_server_url = "https://github.e.it.census.gov" - cluster_config = { - cluster_name = "dev-eks-01" - account_name = "dev-account" - aws_account_id = "123456789012" - aws_profile = "dev-profile" - environment_abbr = "dev" - vpc_name = "dev-vpc" - vpc_domain_name = "dev.example.com" - } -} - -provider "github" { - base_url = var.github_server_url -} - -# Test invalid cluster version -run "invalid_cluster_version" { - command = plan - - variables { - versions = { - cluster_version = "1.26" # Test outdated version - } - } - - expect_failures = [ - var.versions - ] -} - -# Test missing required variables -run "missing_required_vars" { - command = plan - - variables { - name = null # Required variable - } - - expect_failures = [ - var.name - ] -} - -# Test invalid environment name -run "invalid_environment" { - command = plan - - variables { - environment = "invalid" # Should be dev, staging, or prod - } - - expect_failures = [ - var.environment - ] -} \ No newline at end of file diff --git a/workflow_trigger.tftest.hcl b/workflow_trigger.tftest.hcl deleted file mode 100644 index 1812c1f..0000000 --- a/workflow_trigger.tftest.hcl +++ /dev/null @@ -1,40 +0,0 @@ -variables { - name = "test-eks-cluster" - organization = "test-org" - template_repo_org = "test-org" - environment = "dev" - region = "us-east-1" - github_server_url = "https://github.e.it.census.gov" - cluster_config = { - cluster_name = "dev-eks-01" - account_name = "dev-account" - aws_account_id = "123456789012" - aws_profile = "dev-profile" - environment_abbr = "dev" - vpc_name = "dev-vpc" - vpc_domain_name = "dev.example.com" - } - enable_modules = { - cert_manager = true - prometheus = true - grafana = true - } -} - -provider "github" { - base_url = var.github_server_url -} - -run "verify_workflow_trigger" { - command = apply - - assert { - condition = can(null_resource.trigger_workflow) - error_message = "Workflow trigger resource should exist" - } - - assert { - condition = null_resource.trigger_workflow.triggers.github_repo_name == module.github_repo.full_name - error_message = "Workflow trigger should use correct repository name" - } -} \ No newline at end of file diff --git a/workflow_trigger.tftest.hcl.tmp b/workflow_trigger.tftest.hcl.tmp deleted file mode 100644 index 1812c1f..0000000 --- a/workflow_trigger.tftest.hcl.tmp +++ /dev/null @@ -1,40 +0,0 @@ -variables { - name = "test-eks-cluster" - organization = "test-org" - template_repo_org = "test-org" - environment = "dev" - region = "us-east-1" - github_server_url = "https://github.e.it.census.gov" - cluster_config = { - cluster_name = "dev-eks-01" - account_name = "dev-account" - aws_account_id = "123456789012" - aws_profile = "dev-profile" - environment_abbr = "dev" - vpc_name = "dev-vpc" - vpc_domain_name = "dev.example.com" - } - enable_modules = { - cert_manager = true - prometheus = true - grafana = true - } -} - -provider "github" { - base_url = var.github_server_url -} - -run "verify_workflow_trigger" { - command = apply - - assert { - condition = can(null_resource.trigger_workflow) - error_message = "Workflow trigger resource should exist" - } - - assert { - condition = null_resource.trigger_workflow.triggers.github_repo_name == module.github_repo.full_name - error_message = "Workflow trigger should use correct repository name" - } -} \ No newline at end of file