@@ -4,9 +4,10 @@ package sysdig_test
44
55import  (
66	"fmt" 
7- 	"github.com/draios/terraform-provider-sysdig/sysdig" 
87	"testing" 
98
9+ 	"github.com/draios/terraform-provider-sysdig/sysdig" 
10+ 
1011	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 
1112	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 
1213)
@@ -22,22 +23,30 @@ func TestAccSysdigIpFilter_fullLifecycle(t *testing.T) {
2223		Steps : []resource.TestStep {
2324			{
2425				// Create resource 
25- 				Config : createIPFilter ("192.168 .1.0/24" , "Initial note" , true ),
26+ 				Config : createIPFilter ("192.169 .1.0/24" , "Initial note" , true ),
2627				Check : resource .ComposeTestCheckFunc (
27- 					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "ip_range" , "192.168 .1.0/24" ),
28+ 					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "ip_range" , "192.169 .1.0/24" ),
2829					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "note" , "Initial note" ),
2930					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "enabled" , "true" ),
3031				),
3132			},
3233			{
3334				// Update resource 
34- 				Config : createIPFilter ("192.168 .2.0/24" , "Updated note" , false ),
35+ 				Config : createIPFilter ("192.169 .2.0/24" , "Updated note" , false ),
3536				Check : resource .ComposeTestCheckFunc (
36- 					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "ip_range" , "192.168 .2.0/24" ),
37+ 					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "ip_range" , "192.169 .2.0/24" ),
3738					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "note" , "Updated note" ),
3839					resource .TestCheckResourceAttr ("sysdig_ip_filter.test" , "enabled" , "false" ),
3940				),
4041			},
42+ 			{
43+ 				// Delete resource 
44+ 				Config :       "" ,
45+ 				RefreshState : true ,
46+ 				Check : resource .ComposeTestCheckFunc (
47+ 					resource .TestCheckNoResourceAttr ("sysdig_ip_filter.test" , "ip_range" ),
48+ 				),
49+ 			},
4150		},
4251	})
4352}
0 commit comments