From 81105fc634cbcb8009bd66cad37d878116c664f1 Mon Sep 17 00:00:00 2001 From: GiliFaroEnv0 Date: Tue, 22 Aug 2023 10:27:50 +0300 Subject: [PATCH 1/2] Fix: make custom roles data test isolated --- tests/integration/026_custom_role/main.tf | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/integration/026_custom_role/main.tf b/tests/integration/026_custom_role/main.tf index 323595e0..6b212a9a 100644 --- a/tests/integration/026_custom_role/main.tf +++ b/tests/integration/026_custom_role/main.tf @@ -45,13 +45,19 @@ resource "env0_custom_role" "custom_role2" { ] } -data "env0_custom_roles" "all_roles" {} +data "env0_custom_roles" "all_roles" { + depends_on = [env0_custom_role.custom_role1, env0_custom_role.custom_role2] +} + +data "env0_team" "team_resource1" { + name = data.env0_custom_roles.all_roles.names[index(data.env0_custom_roles.all_roles.names, env0_custom_role.custom_role1.name)] +} -data "env0_custom_role" "roles" { - for_each = toset(data.env0_custom_roles.all_roles.names) - name = each.value +data "env0_team" "team_resource2" { + name = data.env0_custom_roles.all_roles.names[index(data.env0_custom_roles.all_roles.names, env0_custom_role.custom_role2.name)] } + resource "env0_api_key" "test_api_key" { name = "api-key-${random_string.random.result}" } From 4635f37a2fec7b27bc8b39615231890172c68dfe Mon Sep 17 00:00:00 2001 From: GiliFaroEnv0 Date: Tue, 22 Aug 2023 10:36:38 +0300 Subject: [PATCH 2/2] Fix: make custom roles data test isolated --- tests/integration/026_custom_role/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/026_custom_role/main.tf b/tests/integration/026_custom_role/main.tf index 6b212a9a..389a46a5 100644 --- a/tests/integration/026_custom_role/main.tf +++ b/tests/integration/026_custom_role/main.tf @@ -49,11 +49,11 @@ data "env0_custom_roles" "all_roles" { depends_on = [env0_custom_role.custom_role1, env0_custom_role.custom_role2] } -data "env0_team" "team_resource1" { +data "env0_custom_role" "team_resource1" { name = data.env0_custom_roles.all_roles.names[index(data.env0_custom_roles.all_roles.names, env0_custom_role.custom_role1.name)] } -data "env0_team" "team_resource2" { +data "env0_custom_role" "team_resource2" { name = data.env0_custom_roles.all_roles.names[index(data.env0_custom_roles.all_roles.names, env0_custom_role.custom_role2.name)] }