@@ -7,9 +7,11 @@ import (
77 "testing"
88 "text/template"
99
10+ "github.com/coder/coder/v2/coderd/util/ptr"
1011 "github.com/coder/terraform-provider-coderd/integration"
1112 "github.com/google/uuid"
1213 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+ "github.com/hashicorp/terraform-plugin-testing/plancheck"
1315 "github.com/stretchr/testify/require"
1416)
1517
@@ -27,15 +29,17 @@ func TestAccProvisionerKeyResource(t *testing.T) {
2729 URL : client .URL .String (),
2830 Token : client .SessionToken (),
2931
30- OrganizationID : firstOrg ,
31- Name : "example-provisioner-key" ,
32+ OrganizationID : & firstOrg ,
33+ Name : ptr . Ref ( "example-provisioner-key" ) ,
3234 }
3335
3436 cfg2 := cfg1
35- cfg2 .Name = "different-provisioner-key"
36- cfg2 .Tags = map [string ]string {
37+ cfg2 .Tags = ptr .Ref (map [string ]string {
3738 "wibble" : "wobble" ,
38- }
39+ })
40+
41+ cfg3 := cfg2
42+ cfg3 .Name = ptr .Ref ("different-provisioner-key" )
3943
4044 resource .Test (t , resource.TestCase {
4145 IsUnitTest : true ,
@@ -47,6 +51,27 @@ func TestAccProvisionerKeyResource(t *testing.T) {
4751 },
4852 {
4953 Config : cfg2 .String (t ),
54+ ConfigPlanChecks : resource.ConfigPlanChecks {
55+ PreApply : []plancheck.PlanCheck {
56+ plancheck .ExpectResourceAction ("coderd_provisioner_key.test" , plancheck .ResourceActionReplace ),
57+ },
58+ },
59+ },
60+ {
61+ Config : cfg2 .String (t ),
62+ ConfigPlanChecks : resource.ConfigPlanChecks {
63+ PreApply : []plancheck.PlanCheck {
64+ plancheck .ExpectResourceAction ("coderd_provisioner_key.test" , plancheck .ResourceActionReplace ),
65+ },
66+ },
67+ },
68+ {
69+ Config : cfg3 .String (t ),
70+ ConfigPlanChecks : resource.ConfigPlanChecks {
71+ PreApply : []plancheck.PlanCheck {
72+ plancheck .ExpectResourceAction ("coderd_provisioner_key.test" , plancheck .ResourceActionReplace ),
73+ },
74+ },
5075 },
5176 },
5277 })
@@ -56,9 +81,9 @@ type testAccProvisionerKeyResourceConfig struct {
5681 URL string
5782 Token string
5883
59- OrganizationID uuid.UUID
60- Name string
61- Tags map [string ]string
84+ OrganizationID * uuid.UUID
85+ Name * string
86+ Tags * map [string ]string
6287}
6388
6489func (c testAccProvisionerKeyResourceConfig ) String (t * testing.T ) string {
0 commit comments