Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split up macro/list creation into different steps #569

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions sysdig/resource_sysdig_secure_macro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -83,34 +92,43 @@ resource "sysdig_secure_macro" "sample2" {
`
}

func macroWithMacro(name1, name2 string) string {
func macroWithMacroPart1(name1 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 {
Expand Down
Loading