diff --git a/go.mod b/go.mod index 197db868..45efe4c3 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/uuid v1.6.0 github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.2.0 github.com/hashicorp/terraform-plugin-docs v0.20.1 - github.com/hashicorp/terraform-plugin-framework v1.13.0 + github.com/hashicorp/terraform-plugin-framework v1.14.0 github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0 github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 github.com/hashicorp/terraform-plugin-go v0.26.0 diff --git a/go.sum b/go.sum index ff5486c0..e248d3aa 100644 --- a/go.sum +++ b/go.sum @@ -139,6 +139,8 @@ github.com/hashicorp/terraform-plugin-docs v0.20.1 h1:Fq7E/HrU8kuZu3hNliZGwloFWS github.com/hashicorp/terraform-plugin-docs v0.20.1/go.mod h1:Yz6HoK7/EgzSrHPB9J/lWFzwl9/xep2OPnc5jaJDV90= github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw= github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU= +github.com/hashicorp/terraform-plugin-framework v1.14.0 h1:lsmTJqBlZ4GUabnDxj8Lsa5bmbuUKiUO3Zm9iIKSDf0= +github.com/hashicorp/terraform-plugin-framework v1.14.0/go.mod h1:xNUKmvTs6ldbwTuId5euAtg37dTxuyj3LHS3uj7BHQ4= github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0 h1:I/N0g/eLZ1ZkLZXUQ0oRSXa8YG/EF0CEuQP1wXdrzKw= github.com/hashicorp/terraform-plugin-framework-timeouts v0.5.0/go.mod h1:t339KhmxnaF4SzdpxmqW8HnQBHVGYazwtfxU0qCs4eE= github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 h1:O9QqGoYDzQT7lwTXUsZEtgabeWW96zUBh47Smn2lkFA= diff --git a/internal/provider/user_resource_test.go b/internal/provider/user_resource_test.go index e06a2f0e..451fdf9e 100644 --- a/internal/provider/user_resource_test.go +++ b/internal/provider/user_resource_test.go @@ -301,3 +301,76 @@ resource "temporalcloud_user" "terraform" { }, }) } + +func TestAccBasicUserWithMultipleNamespaceAccesses(t *testing.T) { + type configArgs struct { + Email string + NamespaceName string + } + + emailAddr := createRandomEmail() + nsName := randomString(10) + + tmpl := template.Must(template.New("config").Parse(` +provider "temporalcloud" { + +} + +resource "temporalcloud_namespace" "test" { + name = "{{ .NamespaceName }}" + regions = ["aws-us-east-1"] + api_key_auth = true + + retention_days = 7 +} + +resource "temporalcloud_namespace" "test2" { + name = "{{ .NamespaceName }}2" + regions = ["aws-us-east-1"] + api_key_auth = true + + retention_days = 7 +} + +resource "temporalcloud_user" "terraform" { + email = "{{ .Email }}" + account_access = "read" + namespace_accesses = [ + { + namespace_id = temporalcloud_namespace.test.id + permission = "Read" + }, + { + namespace_id = temporalcloud_namespace.test2.id + permission = "Write" + }, + ] +}`)) + + config := func(args configArgs) string { + var buf bytes.Buffer + writer := bufio.NewWriter(&buf) + if err := tmpl.Execute(writer, args); err != nil { + t.Errorf("failed to execute template: %v", err) + t.FailNow() + } + + writer.Flush() + return buf.String() + } + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: config(configArgs{ + Email: emailAddr, + NamespaceName: nsName, + }), + }, + }, + }) +}