Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3283edd

Browse files
committed
fix: use server computed org display name
1 parent 5fa9117 commit 3283edd

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

internal/provider/organization_resource.go

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ This resource is only compatible with Coder version [2.16.0](https://github.com/
119119
MarkdownDescription: "Display name of the organization. Defaults to name.",
120120
Computed: true,
121121
Optional: true,
122-
Default: stringdefault.StaticString(""),
123122
Validators: []validator.String{
124123
codersdkvalidator.DisplayName(),
125124
},

internal/provider/organization_resource_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,29 @@ func TestAccOrganizationResource(t *testing.T) {
9999
},
100100
})
101101
})
102+
103+
t.Run("DefaultDisplayName", func(t *testing.T) {
104+
cfg1 := testAccOrganizationResourceConfig{
105+
URL: client.URL.String(),
106+
Token: client.SessionToken(),
107+
Name: ptr.Ref("example-org"),
108+
Description: ptr.Ref("This is an example organization"),
109+
Icon: ptr.Ref("/icon/coder.svg"),
110+
}
111+
resource.Test(t, resource.TestCase{
112+
IsUnitTest: true,
113+
PreCheck: func() { testAccPreCheck(t) },
114+
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
115+
Steps: []resource.TestStep{
116+
{
117+
Config: cfg1.String(t),
118+
ConfigStateChecks: []statecheck.StateCheck{
119+
statecheck.ExpectKnownValue("coderd_organization.test", tfjsonpath.New("display_name"), knownvalue.StringExact("example-org")),
120+
},
121+
},
122+
},
123+
})
124+
})
102125
}
103126

104127
type testAccOrganizationResourceConfig struct {

0 commit comments

Comments
 (0)