File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ package sysdig_test
44
55import (
66 "os"
7+ "strings"
78 "testing"
89
910 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -13,6 +14,18 @@ import (
1314)
1415
1516func TestAccManagedPolicyDataSource (t * testing.T ) {
17+ steps := []resource.TestStep {
18+ {
19+ Config : managedPolicyDataSource (),
20+ },
21+ }
22+
23+ if ! strings .HasSuffix (os .Getenv ("SYSDIG_SECURE_URL" ), "ibm.com" ) {
24+ steps = append (steps , resource.TestStep {
25+ Config : managedStatefulPolicyDataSource (),
26+ },
27+ )
28+ }
1629 resource .ParallelTest (t , resource.TestCase {
1730 PreCheck : func () {
1831 if v := os .Getenv ("SYSDIG_SECURE_API_TOKEN" ); v == "" {
@@ -40,3 +53,12 @@ data "sysdig_secure_managed_policy" "example" {
4053}
4154`
4255}
56+
57+ func managedStatefulPolicyDataSource () string {
58+ return `
59+ data "sysdig_secure_managed_policy" "stateful_example" {
60+ name = "Sysdig AWS Behavioral Analytics Threat Detection"
61+ enabled = false
62+ type = "awscloudtrail_stateful"
63+ `
64+ }
Original file line number Diff line number Diff line change 11package sysdig_test
22
33import (
4+ "fmt"
45 "os"
6+ "strings"
57 "testing"
68
79 "github.com/draios/terraform-provider-sysdig/sysdig"
@@ -11,6 +13,10 @@ import (
1113)
1214
1315func TestRuleStatefulAppends (t * testing.T ) {
16+ if strings .HasSuffix (os .Getenv ("SYSDIG_SECURE_URL" ), "ibm.com" ) {
17+ t .Skip ("Skipping stateful tests for IBM Cloud" )
18+ return
19+ }
1420 steps := []resource.TestStep {
1521 {
1622 Config : ruleStatefulAppend (rName ()),
@@ -20,7 +26,7 @@ func TestRuleStatefulAppends(t *testing.T) {
2026}
2127
2228func ruleStatefulAppend (name string ) string {
23- return `
29+ return fmt . Sprintf ( `
2430 resource "sysdig_secure_rule_stateful" "stateful_rule_append" {
2531 name = "API Gateway Enumeration Detected"
2632 source = "awscloudtrail_stateful"
@@ -30,7 +36,7 @@ func ruleStatefulAppend(name string) string {
3036 values = jsonencode([["abc", ["docker.io/library/busybox"]]])
3137 name = "tf_append_%s"
3238 }
33- }`
39+ }` , name )
3440}
3541
3642func rName () string { return acctest .RandStringFromCharSet (10 , acctest .CharSetAlphaNum ) }
You can’t perform that action at this time.
0 commit comments