@@ -21,25 +21,27 @@ func TestAccCodefreshPermissionConfig(t *testing.T) {
2121 CheckDestroy : testAccCheckCodefreshContextDestroy ,
2222 Steps : []resource.TestStep {
2323 {
24- Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "null" , []string {"production" , "*" } ),
24+ Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "null" , []string {"production" , "test" }, "all" ),
2525 Check : resource .ComposeTestCheckFunc (
2626 testAccCheckCodefreshPermissionExists (resourceName ),
2727 resource .TestCheckResourceAttr (resourceName , "action" , "create" ),
2828 resource .TestCheckResourceAttr (resourceName , "resource" , "pipeline" ),
29- resource .TestCheckResourceAttr (resourceName , "tags.0" , "* " ),
29+ resource .TestCheckResourceAttr (resourceName , "tags.0" , "production " ),
3030 resource .TestCheckResourceAttr (resourceName , "related_resource" , "" ),
31- resource .TestCheckResourceAttr (resourceName , "tags.1" , "production" ),
31+ resource .TestCheckResourceAttr (resourceName , "tags.1" , "test" ),
32+ resource .TestCheckResourceAttr (resourceName , "rule_type" , "all" ),
3233 ),
3334 },
3435 {
35- Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "project" , []string {"production" , "*" }),
36+ Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "project" , []string {"production" , "*" }, "any" ),
3637 Check : resource .ComposeTestCheckFunc (
3738 testAccCheckCodefreshPermissionExists (resourceName ),
3839 resource .TestCheckResourceAttr (resourceName , "action" , "create" ),
3940 resource .TestCheckResourceAttr (resourceName , "resource" , "pipeline" ),
4041 resource .TestCheckResourceAttr (resourceName , "related_resource" , "project" ),
4142 resource .TestCheckResourceAttr (resourceName , "tags.0" , "*" ),
4243 resource .TestCheckResourceAttr (resourceName , "tags.1" , "production" ),
44+ resource .TestCheckResourceAttr (resourceName , "rule_type" , "any" ),
4345 ),
4446 },
4547 {
@@ -73,7 +75,7 @@ func testAccCheckCodefreshPermissionExists(resource string) resource.TestCheckFu
7375}
7476
7577// CONFIGS
76- func testAccCodefreshPermissionConfig (action , resource , relatedResource string , tags []string ) string {
78+ func testAccCodefreshPermissionConfig (action , resource , relatedResource string , tags []string , ruleType string ) string {
7779 escapeString := func (str string ) string {
7880 if str == "null" {
7981 return str // null means Terraform should ignore this field
@@ -93,6 +95,7 @@ func testAccCodefreshPermissionConfig(action, resource, relatedResource string,
9395 resource = %s
9496 related_resource = %s
9597 tags = [%s]
98+ rule_type = %s
9699 }
97- ` , escapeString (action ), escapeString (resource ), escapeString (relatedResource ), strings .Join (tagsEscaped [:], "," ))
100+ ` , escapeString (action ), escapeString (resource ), escapeString (relatedResource ), strings .Join (tagsEscaped [:], "," ), escapeString ( ruleType ) )
98101}
0 commit comments