Skip to content

Commit

Permalink
Merge pull request #7 from appvia/enable_tf_tests
Browse files Browse the repository at this point in the history
feat: enable terraform test by default
  • Loading branch information
gambol99 authored Jun 5, 2024
2 parents 82e21f5 + 723bbc4 commit f705267
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ jobs:
uses: appvia/appvia-cicd-workflows/.github/workflows/terraform-module-validation.yml@main
name: Module Validation
with:
enable-terraform-tests: false
working-directory: .
34 changes: 20 additions & 14 deletions tests/basic.tftest.hcl → tests/module.tftest.hcl
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
mock_provider "aws" {

mock_data "aws_availability_zones" {
defaults = {
names = [
"eu-west-1a",
"eu-west-1b",
"eu-west-1c"
]
}
}
}

run "basic_resolver" {
run "basic" {
command = plan

variables {
resolver_name = "test"
resolver_vpc_id = "vpc-abc123"

resolver_subnet_ids = [
"subnet-abc123",
"subnet-def456",
]
resolver_name = "test"
resolver_protocols = ["Do53"]
network = {
vpc_cidr = "10.90.0.0/21"
transit_gateway_id = "tgw-04ad8f026be8b7eb6"
}
tags = {
"Environment" = "Testing"
"GitRepo" = "https://github.com/appvia/terraform-aws-dns"
}
}

assert {
Expand All @@ -34,9 +45,4 @@ run "basic_resolver" {
condition = aws_route53_resolver_endpoint.this.resolver_endpoint_type == "IPV4"
error_message = "Resolver endpoint type should be IPV4"
}

assert {
condition = aws_security_group.this.name == "${var.resolver_name}-sg"
error_message = "Expected security group name to have -sg suffix"
}
}

0 comments on commit f705267

Please sign in to comment.