@@ -10,6 +10,7 @@ import (
10
10
"github.com/cloudflare/terraform-provider-cloudflare/internal/consts"
11
11
"github.com/cloudflare/terraform-provider-cloudflare/internal/utils"
12
12
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
13
+ "github.com/hashicorp/terraform-plugin-testing/plancheck"
13
14
"github.com/hashicorp/terraform-plugin-testing/terraform"
14
15
)
15
16
@@ -43,7 +44,7 @@ func TestAccCloudflareAccessOrganization(t *testing.T) {
43
44
resource .TestCheckResourceAttr (name , "auth_domain" , rnd + "-" + testAuthDomain ()),
44
45
resource .TestCheckResourceAttr (name , "is_ui_read_only" , "false" ),
45
46
resource .TestCheckResourceAttr (name , "user_seat_expiration_inactive_time" , "1460h" ),
46
- resource .TestCheckNoResourceAttr (name , "auto_redirect_to_identity" ),
47
+ resource .TestCheckResourceAttr (name , "auto_redirect_to_identity" , "false " ),
47
48
resource .TestCheckResourceAttr (name , "login_design.background_color" , "#FFFFFF" ),
48
49
resource .TestCheckResourceAttr (name , "login_design.text_color" , "#000000" ),
49
50
resource .TestCheckResourceAttr (name , "login_design.logo_path" , "https://example.com/logo.png" ),
@@ -53,29 +54,33 @@ func TestAccCloudflareAccessOrganization(t *testing.T) {
53
54
resource .TestCheckResourceAttr (name , "warp_auth_session_duration" , "36h" ),
54
55
resource .TestCheckResourceAttr (name , "allow_authenticate_via_warp" , "false" ),
55
56
),
56
- ResourceName : name ,
57
- ImportState : true ,
58
- ImportStateId : accountID ,
59
- ImportStateCheck : accessOrgImportStateCheck ,
60
57
},
61
58
{
62
- Config : testAccCloudflareAccessOrganizationConfigBasic (rnd , accountID , headerText + " updated" , testAuthDomain ()),
59
+ Config : testAccCloudflareAccessOrganizationConfigBasic (rnd , accountID , headerText , testAuthDomain ()),
63
60
Check : resource .ComposeTestCheckFunc (
64
61
resource .TestCheckResourceAttr (name , consts .AccountIDSchemaKey , accountID ),
65
62
resource .TestCheckResourceAttr (name , "name" , testAuthDomain ()),
66
63
resource .TestCheckResourceAttr (name , "auth_domain" , rnd + "-" + testAuthDomain ()),
67
64
resource .TestCheckResourceAttr (name , "is_ui_read_only" , "false" ),
68
65
resource .TestCheckResourceAttr (name , "user_seat_expiration_inactive_time" , "1460h" ),
69
- resource .TestCheckNoResourceAttr (name , "auto_redirect_to_identity" ),
66
+ resource .TestCheckResourceAttr (name , "auto_redirect_to_identity" , "false " ),
70
67
resource .TestCheckResourceAttr (name , "login_design.background_color" , "#FFFFFF" ),
71
68
resource .TestCheckResourceAttr (name , "login_design.text_color" , "#000000" ),
72
69
resource .TestCheckResourceAttr (name , "login_design.logo_path" , "https://example.com/logo.png" ),
73
- resource .TestCheckResourceAttr (name , "login_design.header_text" , headerText + " updated" ),
70
+ resource .TestCheckResourceAttr (name , "login_design.header_text" , headerText ),
74
71
resource .TestCheckResourceAttr (name , "login_design.footer_text" , "My footer text" ),
75
72
resource .TestCheckResourceAttr (name , "session_duration" , "12h" ),
76
73
resource .TestCheckResourceAttr (name , "warp_auth_session_duration" , "36h" ),
77
74
resource .TestCheckResourceAttr (name , "allow_authenticate_via_warp" , "false" ),
78
75
),
76
+ ConfigPlanChecks : resource.ConfigPlanChecks {
77
+ PreApply : []plancheck.PlanCheck {
78
+ plancheck .ExpectResourceAction (name , plancheck .ResourceActionNoop ),
79
+ plancheck .ExpectEmptyPlan (),
80
+ },
81
+ },
82
+ },
83
+ {
79
84
ResourceName : name ,
80
85
ImportState : true ,
81
86
ImportStateId : accountID ,
@@ -95,6 +100,8 @@ func TestAccCloudflareAccessOrganization(t *testing.T) {
95
100
resource .TestCheckNoResourceAttr (name , "login_design.header_text" ),
96
101
resource .TestCheckNoResourceAttr (name , "login_design.footer_text" ),
97
102
),
103
+ },
104
+ {
98
105
ResourceName : name ,
99
106
ImportState : true ,
100
107
ImportStateId : accountID ,
@@ -168,7 +175,7 @@ func accessOrgImportStateCheckEmpty(instanceStates []*terraform.InstanceState) e
168
175
{field : consts .AccountIDSchemaKey , stateValue : attrs [consts .AccountIDSchemaKey ], expectedValue : accountID },
169
176
{field : "is_ui_read_only" , stateValue : attrs ["is_ui_read_only" ], expectedValue : "false" },
170
177
{field : "auto_redirect_to_identity" , stateValue : attrs ["auto_redirect_to_identity" ], expectedValue : "false" },
171
- {field : "user_seat_expiration_inactive_time" , stateValue : attrs ["user_seat_expiration_inactive_time" ], expectedValue : "1460h " },
178
+ {field : "user_seat_expiration_inactive_time" , stateValue : attrs ["user_seat_expiration_inactive_time" ], expectedValue : "" },
172
179
}
173
180
174
181
for _ , check := range stateChecks {
0 commit comments