From 90a4a84c758d21926c35a6011ede416a472d70ac Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Fri, 15 Nov 2024 14:41:17 -0800 Subject: [PATCH 1/2] split up macro/list creation into different steps --- sysdig/resource_sysdig_secure_macro_test.go | 32 ++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/sysdig/resource_sysdig_secure_macro_test.go b/sysdig/resource_sysdig_secure_macro_test.go index 8e121388..ed6a0dc2 100644 --- a/sysdig/resource_sysdig_secure_macro_test.go +++ b/sysdig/resource_sysdig_secure_macro_test.go @@ -43,10 +43,19 @@ func TestAccMacro(t *testing.T) { Config: macroAppendToDefault(), }, { - Config: macroWithMacro(rText(), rText()), + Config: macroWithMacroPart1(rText()), }, { - Config: macroWithMacroAndList(rText(), rText(), rText()), + Config: macroWithMacroPart2(rText()), + }, + { + Config: listWithName(rText()), + }, + { + Config: macroWithMacroAndListPart1(rText()), + }, + { + Config: macroWithMacroAndListPart2(rText()), }, { Config: macroWithMinimumEngineVersion(rText()), @@ -83,34 +92,43 @@ resource "sysdig_secure_macro" "sample2" { ` } -func macroWithMacro(name1, name2 string) string { +func macroWithMacroPart1(name1, name2 string) string { return fmt.Sprintf(` resource "sysdig_secure_macro" "sample3" { name = "terraform_test_%s" condition = "always_true" } +`, name1) +} +func macroWithMacroPart2(name2 string) string { + return fmt.Sprintf(` resource "sysdig_secure_macro" "sample4" { name = "terraform_test_%s" condition = "never_true and ${sysdig_secure_macro.sample3.name}" } -`, name1, name2) +`, name2) } -func macroWithMacroAndList(name1, name2, name3 string) string { +func macroWithMacroAndListPart1(name1 string) string { return fmt.Sprintf(` -%s resource "sysdig_secure_macro" "sample5" { name = "terraform_test_%s" condition = "fd.name in (${sysdig_secure_list.sample.name})" } +`, name1) +} + +func macroWithMacroAndListPart2(name1 string) string { + return fmt.Sprintf(` + resource "sysdig_secure_macro" "sample6" { name = "terraform_test_%s" condition = "never_true and ${sysdig_secure_macro.sample5.name}" } -`, listWithName(name3), name1, name2) +`, name1) } func macroWithMinimumEngineVersion(name string) string { From 576b4ed57d2a0b000f27c1c4266075f53cb6f4b5 Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Fri, 15 Nov 2024 14:49:30 -0800 Subject: [PATCH 2/2] Update resource_sysdig_secure_macro_test.go --- sysdig/resource_sysdig_secure_macro_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdig/resource_sysdig_secure_macro_test.go b/sysdig/resource_sysdig_secure_macro_test.go index ed6a0dc2..e720cb52 100644 --- a/sysdig/resource_sysdig_secure_macro_test.go +++ b/sysdig/resource_sysdig_secure_macro_test.go @@ -92,7 +92,7 @@ resource "sysdig_secure_macro" "sample2" { ` } -func macroWithMacroPart1(name1, name2 string) string { +func macroWithMacroPart1(name1 string) string { return fmt.Sprintf(` resource "sysdig_secure_macro" "sample3" { name = "terraform_test_%s"