@@ -21,25 +21,27 @@ func TestAccCodefreshPermissionConfig(t *testing.T) {
21
21
CheckDestroy : testAccCheckCodefreshContextDestroy ,
22
22
Steps : []resource.TestStep {
23
23
{
24
- Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "null" , []string {"production" , "*" } ),
24
+ Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "null" , []string {"production" , "test" }, "all" ),
25
25
Check : resource .ComposeTestCheckFunc (
26
26
testAccCheckCodefreshPermissionExists (resourceName ),
27
27
resource .TestCheckResourceAttr (resourceName , "action" , "create" ),
28
28
resource .TestCheckResourceAttr (resourceName , "resource" , "pipeline" ),
29
- resource .TestCheckResourceAttr (resourceName , "tags.0" , "* " ),
29
+ resource .TestCheckResourceAttr (resourceName , "tags.0" , "production " ),
30
30
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" ),
32
33
),
33
34
},
34
35
{
35
- Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "project" , []string {"production" , "*" }),
36
+ Config : testAccCodefreshPermissionConfig ("create" , "pipeline" , "project" , []string {"production" , "*" }, "any" ),
36
37
Check : resource .ComposeTestCheckFunc (
37
38
testAccCheckCodefreshPermissionExists (resourceName ),
38
39
resource .TestCheckResourceAttr (resourceName , "action" , "create" ),
39
40
resource .TestCheckResourceAttr (resourceName , "resource" , "pipeline" ),
40
41
resource .TestCheckResourceAttr (resourceName , "related_resource" , "project" ),
41
42
resource .TestCheckResourceAttr (resourceName , "tags.0" , "*" ),
42
43
resource .TestCheckResourceAttr (resourceName , "tags.1" , "production" ),
44
+ resource .TestCheckResourceAttr (resourceName , "rule_type" , "any" ),
43
45
),
44
46
},
45
47
{
@@ -73,7 +75,7 @@ func testAccCheckCodefreshPermissionExists(resource string) resource.TestCheckFu
73
75
}
74
76
75
77
// CONFIGS
76
- func testAccCodefreshPermissionConfig (action , resource , relatedResource string , tags []string ) string {
78
+ func testAccCodefreshPermissionConfig (action , resource , relatedResource string , tags []string , ruleType string ) string {
77
79
escapeString := func (str string ) string {
78
80
if str == "null" {
79
81
return str // null means Terraform should ignore this field
@@ -93,6 +95,7 @@ func testAccCodefreshPermissionConfig(action, resource, relatedResource string,
93
95
resource = %s
94
96
related_resource = %s
95
97
tags = [%s]
98
+ rule_type = %s
96
99
}
97
- ` , escapeString (action ), escapeString (resource ), escapeString (relatedResource ), strings .Join (tagsEscaped [:], "," ))
100
+ ` , escapeString (action ), escapeString (resource ), escapeString (relatedResource ), strings .Join (tagsEscaped [:], "," ), escapeString ( ruleType ) )
98
101
}
0 commit comments