Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@ tasks:
cd "$testdir" && \
echo "Running tests in $testdir..." && \
terraform init -input=false -reconfigure && \
terraform test || \
echo "FAILED: $testfile" >> "$TEMP_DIR/failures"
OUTPUT=$(terraform test -no-color 2>&1)
TEST_EXIT=$?
echo "$OUTPUT"
if [ $TEST_EXIT -ne 0 ]; then
echo "FAILED: $testfile" >> "$TEMP_DIR/failures"
fi
# Check for warnings (case-insensitive)
if echo "$OUTPUT" | grep -qi "Warning:"; then
echo "WARNINGS: $testfile" >> "$TEMP_DIR/warnings"
fi
) &
done
# Wait for all background jobs to complete
Expand All @@ -36,6 +44,13 @@ tasks:
rm -rf "$TEMP_DIR"
exit 1
fi
# Check if any warnings were found
if [ -f "$TEMP_DIR/warnings" ]; then
echo "Tests completed with warnings:"
cat "$TEMP_DIR/warnings"
rm -rf "$TEMP_DIR"
exit 1
fi
rm -rf "$TEMP_DIR"
else
echo "Module path '$MODULE' does not exist."
Expand Down
2 changes: 1 addition & 1 deletion terraform/cluster/aws-eks/additions/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ resource "kubernetes_config_map" "external_dns" {
}

data = {
aws_region = var.route53_region != null ? var.route53_region : data.aws_region.current.name
aws_region = var.route53_region != null ? var.route53_region : data.aws_region.current.region
txt_owner_id = local.cluster_name
}
}
3 changes: 2 additions & 1 deletion terraform/cluster/aws-eks/additions/test.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mock_provider "aws" {
}
mock_data "aws_region" {
defaults = {
name = "us-west-2"
name = "us-west-2"
region = "us-west-2"
}
}
mock_data "aws_eks_cluster" {
Expand Down
4 changes: 2 additions & 2 deletions terraform/cluster/aws-eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ resource "aws_kms_key" "eks_encryption_key" {
Sid = "Allow CloudWatch Logs to use the key",
Effect = "Allow",
Principal = {
Service = "logs.${data.aws_region.current.name}.amazonaws.com"
Service = "logs.${data.aws_region.current.region}.amazonaws.com"
},
Action = [
"kms:Encrypt",
Expand Down Expand Up @@ -746,7 +746,7 @@ resource "local_sensitive_file" "kubeconfig" {
cluster_name = aws_eks_cluster.main.name
cluster_endpoint = aws_eks_cluster.main.endpoint
cluster_ca = aws_eks_cluster.main.certificate_authority[0].data
region = data.aws_region.current.name
region = data.aws_region.current.region
})
filename = local.kubeconfig_path
file_permission = "0600"
Expand Down
3 changes: 1 addition & 2 deletions terraform/cluster/aws-eks/test.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ run "minimal_configuration" {

variables {
context_id = "test"
name = "windsor-eks"
kubernetes_version = "1.32"
}

Expand Down Expand Up @@ -81,7 +80,7 @@ run "minimal_configuration_cloudwatch_logs_disabled" {

variables {
context_id = "test"
name = "windsor-eks"
cluster_name = "windsor-eks"
kubernetes_version = "1.32"
enable_cloudwatch_logs = false
}
Expand Down
4 changes: 2 additions & 2 deletions terraform/network/aws-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ resource "aws_kms_key" "vpc_flow_logs" {
Sid = "Allow CloudWatch Logs to use the key",
Effect = "Allow",
Principal = {
Service = "logs.${data.aws_region.current.name}.amazonaws.com"
Service = "logs.${data.aws_region.current.region}.amazonaws.com"
},
Action = [
"kms:Encrypt",
Expand Down Expand Up @@ -193,7 +193,7 @@ resource "aws_iam_role_policy" "vpc_flow_logs" {
"logs:DescribeLogStreams"
]
Resource = [
"arn:aws:logs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:log-group:/aws/vpc/flow-logs/${local.name}-*"
"arn:aws:logs:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:log-group:/aws/vpc/flow-logs/${local.name}-*"
]
}
]
Expand Down
Loading