Files
Aws-Terraform/tests/network_group3/tests/osaka_plan.tftest.hcl
T

68 lines
2.1 KiB
HCL

provider "aws" {
region = var.region
}
# Flow Logs need pre-existing destinations, including a global IAM role for
# CloudWatch. Override only these two resources so the isolated test creates no
# global resource and never refers to production destinations.
override_resource {
target = module.network_public.aws_flow_log.s3
values = { id = "fl-test-s3" }
}
override_resource {
target = module.network_public.aws_flow_log.cloudwatch
values = { id = "fl-test-cloudwatch" }
}
# Stable computed IDs let plan-mode assertions verify the eleven links without
# creating resources. The apply-mode file intentionally does not override these.
override_resource {
target = aws_security_group.vyos_source
override_during = plan
values = {
id = "sg-00000000000000000"
name = "tftest-g3-8c2f-vyos-source"
}
}
override_resource {
target = aws_network_interface.route_target
override_during = plan
values = {
id = "eni-00000000000000000"
}
}
variables {
region = "ap-northeast-3"
name_prefix = "tftest-g3-8c2f"
web_ami_id = "ami-0d82c759aab529d2d"
test_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHSftYPnELJxLgR9G8ftBeCIYo57KmlEc8A8BmqAHSLP tftest-g3-8c2f"
}
run "plan_network_group3_osaka" {
command = plan
assert {
condition = length(output.vyos_route_network_interface_ids) == 5 && alltrue([
for id in values(output.vyos_route_network_interface_ids) : id == output.route_target_network_interface_id
])
error_message = "All five VyOS routes must target the substitute network interface."
}
assert {
condition = length(output.vyos_source_security_group_ids) == 6 && alltrue([
for id in values(output.vyos_source_security_group_ids) : id == output.vyos_source_security_group_id
])
error_message = "All six public ingress rules must reference the substitute security group."
}
assert {
condition = alltrue([
for name in values(output.named_resources) : startswith(name, var.name_prefix)
])
error_message = "Every named Osaka test resource must use the dedicated prefix."
}
}