Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
73 changes: 73 additions & 0 deletions internal/provider/user_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
},
},
})
}
Loading