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