|
6 | 6 | "testing"
|
7 | 7 |
|
8 | 8 | "github.com/codefresh-io/terraform-provider-codefresh/codefresh/cfclient"
|
9 |
| - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" |
10 |
| - |
11 | 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
|
| 10 | + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" |
12 | 11 | funk "github.com/thoas/go-funk"
|
13 | 12 | )
|
14 | 13 |
|
@@ -41,6 +40,58 @@ func TestAccCodefreshAbacRulesConfig(t *testing.T) {
|
41 | 40 | resource.TestCheckResourceAttr(resourceName, "tags.1", "production"),
|
42 | 41 | ),
|
43 | 42 | },
|
| 43 | + { |
| 44 | + Config: testAccCodefreshAbacRulesConfig( |
| 45 | + "promotionFlows", |
| 46 | + "", |
| 47 | + "", |
| 48 | + "", |
| 49 | + []string{"TRIGGER_PROMOTION"}, |
| 50 | + []string{"staging"}, |
| 51 | + ), |
| 52 | + Check: resource.ComposeTestCheckFunc( |
| 53 | + testAccCheckCodefreshAbacRulesExists(resourceName), |
| 54 | + resource.TestCheckResourceAttr(resourceName, "entity_type", "promotionFlows"), |
| 55 | + resource.TestCheckResourceAttr(resourceName, "actions.0", "TRIGGER_PROMOTION"), |
| 56 | + resource.TestCheckResourceAttr(resourceName, "tags.0", "staging"), |
| 57 | + ), |
| 58 | + }, |
| 59 | + { |
| 60 | + Config: testAccCodefreshAbacRulesConfig( |
| 61 | + "products", |
| 62 | + "", |
| 63 | + "", |
| 64 | + "", |
| 65 | + []string{"TRIGGER_PROMOTION", "RETRY_RELEASE"}, |
| 66 | + []string{"dev", "qa"}, |
| 67 | + ), |
| 68 | + Check: resource.ComposeTestCheckFunc( |
| 69 | + testAccCheckCodefreshAbacRulesExists(resourceName), |
| 70 | + resource.TestCheckResourceAttr(resourceName, "entity_type", "products"), |
| 71 | + resource.TestCheckResourceAttr(resourceName, "actions.#", "2"), |
| 72 | + resource.TestCheckTypeSetElemAttr(resourceName, "actions.*", "TRIGGER_PROMOTION"), |
| 73 | + resource.TestCheckTypeSetElemAttr(resourceName, "actions.*", "RETRY_RELEASE"), |
| 74 | + resource.TestCheckResourceAttr(resourceName, "tags.#", "2"), |
| 75 | + resource.TestCheckTypeSetElemAttr(resourceName, "tags.*", "dev"), |
| 76 | + resource.TestCheckTypeSetElemAttr(resourceName, "tags.*", "qa"), |
| 77 | + ), |
| 78 | + }, |
| 79 | + { |
| 80 | + Config: testAccCodefreshAbacRulesConfig( |
| 81 | + "environments", |
| 82 | + "", |
| 83 | + "", |
| 84 | + "", |
| 85 | + []string{"PROMOTE_TO"}, |
| 86 | + []string{"production"}, |
| 87 | + ), |
| 88 | + Check: resource.ComposeTestCheckFunc( |
| 89 | + testAccCheckCodefreshAbacRulesExists(resourceName), |
| 90 | + resource.TestCheckResourceAttr(resourceName, "entity_type", "environments"), |
| 91 | + resource.TestCheckResourceAttr(resourceName, "actions.0", "PROMOTE_TO"), |
| 92 | + resource.TestCheckResourceAttr(resourceName, "tags.0", "production"), |
| 93 | + ), |
| 94 | + }, |
44 | 95 | {
|
45 | 96 | ResourceName: resourceName,
|
46 | 97 | ImportState: true,
|
|
0 commit comments