From 7ab4656fd63a19bccbd337c7ac49e505e1c88a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wawrzyniec=20=27Wawrzek=27=20Niewodnicza=C5=84ski?= Date: Wed, 22 Jan 2025 13:09:27 +0000 Subject: [PATCH] Fix backend tests --- backend/tests/main.tftest.hcl | 11 +++++++++++ backend/tests/setup/main.tf | 18 ++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/backend/tests/main.tftest.hcl b/backend/tests/main.tftest.hcl index 27f0499..57a3f4c 100644 --- a/backend/tests/main.tftest.hcl +++ b/backend/tests/main.tftest.hcl @@ -36,3 +36,14 @@ run "apply" { network-proxy-cidr = run.setup.proxy-cidr } } + +run "apply_sa" { + command = apply + variables { + name = "test51" + network-id = run.setup.net + network-subnet-id = run.setup.back-id + network-proxy-cidr = run.setup.proxy-cidr + sa-email = run.setup.sa-email + } +} diff --git a/backend/tests/setup/main.tf b/backend/tests/setup/main.tf index bc47084..422b28f 100644 --- a/backend/tests/setup/main.tf +++ b/backend/tests/setup/main.tf @@ -3,14 +3,28 @@ module "network" { name = "test44" } -output "net" { - value = module.network.network-id +module "sa" { + source = "../../../service_account" + name = "test44" + display_name = "SA for tofu backend test" + roles = [ + "roles/logging.logWriter", + "roles/monitoring.metricWriter" + ] } output "back-id" { value = module.network.subnet-id-backend } +output "net" { + value = module.network.network-id +} + output "proxy-cidr" { value = module.network.subnet-cidr-proxy } + +output "sa-email" { + value = module.sa.email +}