Skip to content

Commit 7cde3aa

Browse files
authored
Update terraform framework to fix case insensitive set logic (#249)
1 parent 1fcd373 commit 7cde3aa

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/google/uuid v1.6.0
99
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0
1010
github.com/hashicorp/terraform-plugin-docs v0.20.1
11-
github.com/hashicorp/terraform-plugin-framework v1.13.0
11+
github.com/hashicorp/terraform-plugin-framework v1.14.0
1212
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0
1313
github.com/hashicorp/terraform-plugin-framework-validators v0.16.0
1414
github.com/hashicorp/terraform-plugin-go v0.26.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ github.com/hashicorp/terraform-plugin-docs v0.20.1 h1:Fq7E/HrU8kuZu3hNliZGwloFWS
139139
github.com/hashicorp/terraform-plugin-docs v0.20.1/go.mod h1:Yz6HoK7/EgzSrHPB9J/lWFzwl9/xep2OPnc5jaJDV90=
140140
github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw=
141141
github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU=
142+
github.com/hashicorp/terraform-plugin-framework v1.14.0 h1:lsmTJqBlZ4GUabnDxj8Lsa5bmbuUKiUO3Zm9iIKSDf0=
143+
github.com/hashicorp/terraform-plugin-framework v1.14.0/go.mod h1:xNUKmvTs6ldbwTuId5euAtg37dTxuyj3LHS3uj7BHQ4=
142144
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0 h1:I/N0g/eLZ1ZkLZXUQ0oRSXa8YG/EF0CEuQP1wXdrzKw=
143145
github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0/go.mod h1:t339KhmxnaF4SzdpxmqW8HnQBHVGYazwtfxU0qCs4eE=
144146
github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 h1:O9QqGoYDzQT7lwTXUsZEtgabeWW96zUBh47Smn2lkFA=

internal/provider/user_resource_test.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,76 @@ resource "temporalcloud_user" "terraform" {
301301
},
302302
})
303303
}
304+
305+
func TestAccBasicUserWithMultipleNamespaceAccesses(t *testing.T) {
306+
type configArgs struct {
307+
Email string
308+
NamespaceName string
309+
}
310+
311+
emailAddr := createRandomEmail()
312+
nsName := randomString(10)
313+
314+
tmpl := template.Must(template.New("config").Parse(`
315+
provider "temporalcloud" {
316+
317+
}
318+
319+
resource "temporalcloud_namespace" "test" {
320+
name = "{{ .NamespaceName }}"
321+
regions = ["aws-us-east-1"]
322+
api_key_auth = true
323+
324+
retention_days = 7
325+
}
326+
327+
resource "temporalcloud_namespace" "test2" {
328+
name = "{{ .NamespaceName }}2"
329+
regions = ["aws-us-east-1"]
330+
api_key_auth = true
331+
332+
retention_days = 7
333+
}
334+
335+
resource "temporalcloud_user" "terraform" {
336+
email = "{{ .Email }}"
337+
account_access = "read"
338+
namespace_accesses = [
339+
{
340+
namespace_id = temporalcloud_namespace.test.id
341+
permission = "Read"
342+
},
343+
{
344+
namespace_id = temporalcloud_namespace.test2.id
345+
permission = "Write"
346+
},
347+
]
348+
}`))
349+
350+
config := func(args configArgs) string {
351+
var buf bytes.Buffer
352+
writer := bufio.NewWriter(&buf)
353+
if err := tmpl.Execute(writer, args); err != nil {
354+
t.Errorf("failed to execute template: %v", err)
355+
t.FailNow()
356+
}
357+
358+
writer.Flush()
359+
return buf.String()
360+
}
361+
362+
resource.ParallelTest(t, resource.TestCase{
363+
PreCheck: func() {
364+
testAccPreCheck(t)
365+
},
366+
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
367+
Steps: []resource.TestStep{
368+
{
369+
Config: config(configArgs{
370+
Email: emailAddr,
371+
NamespaceName: nsName,
372+
}),
373+
},
374+
},
375+
})
376+
}

0 commit comments

Comments
 (0)