diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index aeb1eeef31f0..c125c89bfdee 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -195,7 +195,7 @@ service/load-balancers: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_lb((.|\n)*)###' service/load-test: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_load_test((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(load_test|playwright_workspace)((.|\n)*)###' service/log-analytics: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_log_analytics_((.|\n)*)###' diff --git a/.teamcity/components/settings.kt b/.teamcity/components/settings.kt index 40d237f80581..85cee921b625 100644 --- a/.teamcity/components/settings.kt +++ b/.teamcity/components/settings.kt @@ -116,6 +116,9 @@ var serviceTestConfigurationOverrides = mapOf( // load balancer global tire Public IP is only available in "loadbalancer" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "eastus2", "westus", false)), + // Playwright workspace is only available in certain locations + "loadtestservice" to testConfiguration(locationOverride = LocationConfiguration("westeurope", "eastus", "westus3", false)), + // Log Analytics Clusters have a max deployments of 2 - parallelism set to 1 or `importTest` fails "loganalytics" to testConfiguration(parallelism = 1), diff --git a/internal/services/loadtestservice/client/client.go b/internal/services/loadtestservice/client/client.go index 2e2a4517ff8e..fc3526b83eef 100644 --- a/internal/services/loadtestservice/client/client.go +++ b/internal/services/loadtestservice/client/client.go @@ -7,12 +7,14 @@ import ( "fmt" loadtestserviceV20221201 "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01" + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type AutoClient struct { - V20221201 loadtestserviceV20221201.Client + V20221201 loadtestserviceV20221201.Client + PlaywrightWorkspacesClient *playwrightworkspaces.PlaywrightWorkspacesClient } func NewClient(o *common.ClientOptions) (*AutoClient, error) { @@ -23,7 +25,14 @@ func NewClient(o *common.ClientOptions) (*AutoClient, error) { return nil, fmt.Errorf("building client for loadtestservice V20221201: %+v", err) } + playwrightWorkspacesClient, err := playwrightworkspaces.NewPlaywrightWorkspacesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building PlaywrightWorkspaces Client: %+v", err) + } + o.Configure(playwrightWorkspacesClient.Client, o.Authorizers.ResourceManager) + return &AutoClient{ - V20221201: *v20221201Client, + V20221201: *v20221201Client, + PlaywrightWorkspacesClient: playwrightWorkspacesClient, }, nil } diff --git a/internal/services/loadtestservice/playwright_workspace_data_source.go b/internal/services/loadtestservice/playwright_workspace_data_source.go new file mode 100644 index 000000000000..9dafbb66c0a2 --- /dev/null +++ b/internal/services/loadtestservice/playwright_workspace_data_source.go @@ -0,0 +1,118 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package loadtestservice + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type PlaywrightWorkspaceDataSource struct{} + +var _ sdk.DataSource = PlaywrightWorkspaceDataSource{} + +type PlaywrightWorkspaceDataSourceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + DataplaneUri string `tfschema:"dataplane_uri"` + WorkspaceId string `tfschema:"workspace_id"` + Tags map[string]string `tfschema:"tags"` +} + +func (PlaywrightWorkspaceDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[a-zA-Z0-9-]{3,24}$`), + "length of `name` must be between 3 and 24 characters (inclusive) and contain only numbers, letters, and hyphens (-)"), + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + } +} + +func (PlaywrightWorkspaceDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "dataplane_uri": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "workspace_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + } +} + +func (PlaywrightWorkspaceDataSource) ModelObject() interface{} { + return &PlaywrightWorkspaceDataSourceModel{} +} + +func (PlaywrightWorkspaceDataSource) ResourceType() string { + return "azurerm_playwright_workspace" +} + +func (PlaywrightWorkspaceDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LoadTestService.PlaywrightWorkspacesClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var state PlaywrightWorkspaceDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := playwrightworkspaces.NewPlaywrightWorkspaceID(subscriptionId, state.ResourceGroupName, state.Name) + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + metadata.SetID(id) + + if model := resp.Model; model != nil { + state.Location = location.NormalizeNilable(&model.Location) + + if properties := model.Properties; properties != nil { + if dataplaneUri := properties.DataplaneUri; dataplaneUri != nil { + state.DataplaneUri = pointer.From(dataplaneUri) + } + + if workspaceId := properties.WorkspaceId; workspaceId != nil { + state.WorkspaceId = pointer.From(workspaceId) + } + } + + state.Tags = pointer.From(model.Tags) + } + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/loadtestservice/playwright_workspace_data_source_test.go b/internal/services/loadtestservice/playwright_workspace_data_source_test.go new file mode 100644 index 000000000000..a5cc44843eb4 --- /dev/null +++ b/internal/services/loadtestservice/playwright_workspace_data_source_test.go @@ -0,0 +1,63 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package loadtestservice_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type PlaywrightWorkspaceDataSource struct{} + +func TestAccPlaywrightWorkspaceDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("location").HasValue(location.Normalize(data.Locations.Secondary)), + check.That(data.ResourceName).Key("dataplane_uri").Exists(), + check.That(data.ResourceName).Key("workspace_id").Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + check.That(data.ResourceName).Key("tags.Environment").HasValue("Sandbox"), + check.That(data.ResourceName).Key("tags.Label").HasValue("Test"), + ), + }, + }) +} + +func (PlaywrightWorkspaceDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-pww-%d" + location = "%s" +} + +resource "azurerm_playwright_workspace" "test" { + name = "acctest-pww-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + tags = { + Environment = "Sandbox" + Label = "Test" + } +} + +data "azurerm_playwright_workspace" "test" { + name = azurerm_playwright_workspace.test.name + resource_group_name = azurerm_playwright_workspace.test.resource_group_name +} +`, data.RandomInteger, data.Locations.Secondary, data.RandomIntOfLength(8)) +} diff --git a/internal/services/loadtestservice/playwright_workspace_resource.go b/internal/services/loadtestservice/playwright_workspace_resource.go new file mode 100644 index 000000000000..c21d0706b60c --- /dev/null +++ b/internal/services/loadtestservice/playwright_workspace_resource.go @@ -0,0 +1,226 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package loadtestservice + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +//go:generate go run ../../tools/generator-tests resourceidentity -resource-name playwright_workspace -service-package-name loadtestservice -properties "name,resource_group_name" -known-values "subscription_id:data.Subscriptions.Primary" + +type PlaywrightWorkspaceResource struct{} + +var _ sdk.ResourceWithIdentity = PlaywrightWorkspaceResource{} + +type PlaywrightWorkspaceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + DataplaneUri string `tfschema:"dataplane_uri"` + WorkspaceId string `tfschema:"workspace_id"` + Tags map[string]string `tfschema:"tags"` +} + +func (PlaywrightWorkspaceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringMatch( + regexp.MustCompile(`^[a-zA-Z0-9-]{3,24}$`), + "length of `name` must be between 3 and 24 characters (inclusive) and contain only numbers, letters, and hyphens (-)"), + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "tags": commonschema.Tags(), + } +} + +func (PlaywrightWorkspaceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "dataplane_uri": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "workspace_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (PlaywrightWorkspaceResource) ModelObject() interface{} { + return &PlaywrightWorkspaceModel{} +} + +func (PlaywrightWorkspaceResource) ResourceType() string { + return "azurerm_playwright_workspace" +} + +func (r PlaywrightWorkspaceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LoadTestService.PlaywrightWorkspacesClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var config PlaywrightWorkspaceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + id := playwrightworkspaces.NewPlaywrightWorkspaceID(subscriptionId, config.ResourceGroupName, config.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + param := playwrightworkspaces.PlaywrightWorkspace{ + Location: location.Normalize(config.Location), + Properties: &playwrightworkspaces.PlaywrightWorkspaceProperties{ + LocalAuth: pointer.To(playwrightworkspaces.EnablementStatusDisabled), + RegionalAffinity: pointer.To(playwrightworkspaces.EnablementStatusEnabled), + }, + Tags: pointer.To(config.Tags), + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + if err := pluginsdk.SetResourceIdentityData(metadata.ResourceData, &id); err != nil { + return err + } + + return nil + }, + } +} + +func (r PlaywrightWorkspaceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LoadTestService.PlaywrightWorkspacesClient + id, err := playwrightworkspaces.ParsePlaywrightWorkspaceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + param := playwrightworkspaces.PlaywrightWorkspaceUpdate{} + var config PlaywrightWorkspaceModel + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + if metadata.ResourceData.HasChange("tags") { + param.Tags = pointer.To(config.Tags) + } + + if _, err := client.Update(ctx, *id, param); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (PlaywrightWorkspaceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LoadTestService.PlaywrightWorkspacesClient + id, err := playwrightworkspaces.ParsePlaywrightWorkspaceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + state := PlaywrightWorkspaceModel{ + Name: id.PlaywrightWorkspaceName, + ResourceGroupName: id.ResourceGroupName, + } + + if model := resp.Model; model != nil { + state.Location = location.NormalizeNilable(&model.Location) + + if properties := model.Properties; properties != nil { + if dataplaneUri := properties.DataplaneUri; dataplaneUri != nil { + state.DataplaneUri = pointer.From(dataplaneUri) + } + + if workspaceId := properties.WorkspaceId; workspaceId != nil { + state.WorkspaceId = pointer.From(workspaceId) + } + } + + state.Tags = pointer.From(model.Tags) + } + + if err := pluginsdk.SetResourceIdentityData(metadata.ResourceData, id); err != nil { + return err + } + + return metadata.Encode(&state) + }, + } +} + +func (PlaywrightWorkspaceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LoadTestService.PlaywrightWorkspacesClient + + id, err := playwrightworkspaces.ParsePlaywrightWorkspaceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + return nil + }, + } +} + +func (PlaywrightWorkspaceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return playwrightworkspaces.ValidatePlaywrightWorkspaceID +} + +func (PlaywrightWorkspaceResource) Identity() resourceids.ResourceId { + return &playwrightworkspaces.PlaywrightWorkspaceId{} +} diff --git a/internal/services/loadtestservice/playwright_workspace_resource_identity_gen_test.go b/internal/services/loadtestservice/playwright_workspace_resource_identity_gen_test.go new file mode 100644 index 000000000000..a450e337b30d --- /dev/null +++ b/internal/services/loadtestservice/playwright_workspace_resource_identity_gen_test.go @@ -0,0 +1,39 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package loadtestservice_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + customstatecheck "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/statecheck" +) + +func TestAccPlaywrightWorkspace_resourceIdentity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceResource{} + + checkedFields := map[string]struct{}{ + "subscription_id": {}, + "name": {}, + "resource_group_name": {}, + } + + data.ResourceIdentityTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + ConfigStateChecks: []statecheck.StateCheck{ + customstatecheck.ExpectAllIdentityFieldsAreChecked("azurerm_playwright_workspace.test", checkedFields), + statecheck.ExpectIdentityValue("azurerm_playwright_workspace.test", tfjsonpath.New("subscription_id"), knownvalue.StringExact(data.Subscriptions.Primary)), + statecheck.ExpectIdentityValueMatchesStateAtPath("azurerm_playwright_workspace.test", tfjsonpath.New("name"), tfjsonpath.New("name")), + statecheck.ExpectIdentityValueMatchesStateAtPath("azurerm_playwright_workspace.test", tfjsonpath.New("resource_group_name"), tfjsonpath.New("resource_group_name")), + }, + }, + data.ImportBlockWithResourceIdentityStep(false), + data.ImportBlockWithIDStep(false), + }, false) +} diff --git a/internal/services/loadtestservice/playwright_workspace_resource_test.go b/internal/services/loadtestservice/playwright_workspace_resource_test.go new file mode 100644 index 000000000000..110ca38b315e --- /dev/null +++ b/internal/services/loadtestservice/playwright_workspace_resource_test.go @@ -0,0 +1,154 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package loadtestservice_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type PlaywrightWorkspaceResource struct{} + +func TestAccPlaywrightWorkspace_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccPlaywrightWorkspace_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccPlaywrightWorkspace_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccPlaywrightWorkspace_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_playwright_workspace", "test") + r := PlaywrightWorkspaceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (PlaywrightWorkspaceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := playwrightworkspaces.ParsePlaywrightWorkspaceID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.LoadTestService.PlaywrightWorkspacesClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func (PlaywrightWorkspaceResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-pww-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Secondary) +} + +func (r PlaywrightWorkspaceResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_playwright_workspace" "test" { + name = "acctest-pww-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} +`, r.template(data), data.RandomIntOfLength(8)) +} + +func (r PlaywrightWorkspaceResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_playwright_workspace" "import" { + name = azurerm_playwright_workspace.test.name + resource_group_name = azurerm_playwright_workspace.test.resource_group_name + location = azurerm_playwright_workspace.test.location +} +`, r.basic(data)) +} + +func (r PlaywrightWorkspaceResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_playwright_workspace" "test" { + name = "acctest-pww-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + tags = { + Environment = "Sandbox" + Label = "Test" + } +} +`, r.template(data), data.RandomIntOfLength(8)) +} diff --git a/internal/services/loadtestservice/registration.go b/internal/services/loadtestservice/registration.go index 2ebe97897be5..fee5c11d1b8b 100644 --- a/internal/services/loadtestservice/registration.go +++ b/internal/services/loadtestservice/registration.go @@ -33,12 +33,14 @@ func (r Registration) Name() string { func (r Registration) DataSources() []sdk.DataSource { return []sdk.DataSource{ LoadTestDataSource{}, + PlaywrightWorkspaceDataSource{}, } } func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ LoadTestResource{}, + PlaywrightWorkspaceResource{}, } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/README.md new file mode 100644 index 000000000000..8d1f75256f5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/README.md @@ -0,0 +1,142 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces` Documentation + +The `playwrightworkspaces` SDK allows for interaction with Azure Resource Manager `loadtestservice` (API Version `2025-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces" +``` + + +### Client Initialization + +```go +client := playwrightworkspaces.NewPlaywrightWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PlaywrightWorkspacesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := playwrightworkspaces.CheckNameAvailabilityRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := playwrightworkspaces.NewPlaywrightWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "playwrightWorkspaceName") + +payload := playwrightworkspaces.PlaywrightWorkspace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := playwrightworkspaces.NewPlaywrightWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "playwrightWorkspaceName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.Get` + +```go +ctx := context.TODO() +id := playwrightworkspaces.NewPlaywrightWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "playwrightWorkspaceName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PlaywrightWorkspacesClient.Update` + +```go +ctx := context.TODO() +id := playwrightworkspaces.NewPlaywrightWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "playwrightWorkspaceName") + +payload := playwrightworkspaces.PlaywrightWorkspaceUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/client.go new file mode 100644 index 000000000000..94e42fe3eee8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/client.go @@ -0,0 +1,26 @@ +package playwrightworkspaces + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspacesClient struct { + Client *resourcemanager.Client +} + +func NewPlaywrightWorkspacesClientWithBaseURI(sdkApi sdkEnv.Api) (*PlaywrightWorkspacesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "playwrightworkspaces", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PlaywrightWorkspacesClient: %+v", err) + } + + return &PlaywrightWorkspacesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/constants.go new file mode 100644 index 000000000000..278e76fc6f8d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/constants.go @@ -0,0 +1,145 @@ +package playwrightworkspaces + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +func PossibleValuesForCheckNameAvailabilityReason() []string { + return []string{ + string(CheckNameAvailabilityReasonAlreadyExists), + string(CheckNameAvailabilityReasonInvalid), + } +} + +func (s *CheckNameAvailabilityReason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCheckNameAvailabilityReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCheckNameAvailabilityReason(input string) (*CheckNameAvailabilityReason, error) { + vals := map[string]CheckNameAvailabilityReason{ + "alreadyexists": CheckNameAvailabilityReasonAlreadyExists, + "invalid": CheckNameAvailabilityReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CheckNameAvailabilityReason(input) + return &out, nil +} + +type EnablementStatus string + +const ( + EnablementStatusDisabled EnablementStatus = "Disabled" + EnablementStatusEnabled EnablementStatus = "Enabled" +) + +func PossibleValuesForEnablementStatus() []string { + return []string{ + string(EnablementStatusDisabled), + string(EnablementStatusEnabled), + } +} + +func (s *EnablementStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEnablementStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEnablementStatus(input string) (*EnablementStatus, error) { + vals := map[string]EnablementStatus{ + "disabled": EnablementStatusDisabled, + "enabled": EnablementStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnablementStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/id_playwrightworkspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/id_playwrightworkspace.go new file mode 100644 index 000000000000..dafd0c8fbad2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/id_playwrightworkspace.go @@ -0,0 +1,130 @@ +package playwrightworkspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PlaywrightWorkspaceId{}) +} + +var _ resourceids.ResourceId = &PlaywrightWorkspaceId{} + +// PlaywrightWorkspaceId is a struct representing the Resource ID for a Playwright Workspace +type PlaywrightWorkspaceId struct { + SubscriptionId string + ResourceGroupName string + PlaywrightWorkspaceName string +} + +// NewPlaywrightWorkspaceID returns a new PlaywrightWorkspaceId struct +func NewPlaywrightWorkspaceID(subscriptionId string, resourceGroupName string, playwrightWorkspaceName string) PlaywrightWorkspaceId { + return PlaywrightWorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PlaywrightWorkspaceName: playwrightWorkspaceName, + } +} + +// ParsePlaywrightWorkspaceID parses 'input' into a PlaywrightWorkspaceId +func ParsePlaywrightWorkspaceID(input string) (*PlaywrightWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PlaywrightWorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PlaywrightWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePlaywrightWorkspaceIDInsensitively parses 'input' case-insensitively into a PlaywrightWorkspaceId +// note: this method should only be used for API response data and not user input +func ParsePlaywrightWorkspaceIDInsensitively(input string) (*PlaywrightWorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PlaywrightWorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PlaywrightWorkspaceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PlaywrightWorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.PlaywrightWorkspaceName, ok = input.Parsed["playwrightWorkspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "playwrightWorkspaceName", input) + } + + return nil +} + +// ValidatePlaywrightWorkspaceID checks that 'input' can be parsed as a Playwright Workspace ID +func ValidatePlaywrightWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePlaywrightWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Playwright Workspace ID +func (id PlaywrightWorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.LoadTestService/playwrightWorkspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PlaywrightWorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Playwright Workspace ID +func (id PlaywrightWorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftLoadTestService", "Microsoft.LoadTestService", "Microsoft.LoadTestService"), + resourceids.StaticSegment("staticPlaywrightWorkspaces", "playwrightWorkspaces", "playwrightWorkspaces"), + resourceids.UserSpecifiedSegment("playwrightWorkspaceName", "playwrightWorkspaceName"), + } +} + +// String returns a human-readable description of this Playwright Workspace ID +func (id PlaywrightWorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Playwright Workspace Name: %q", id.PlaywrightWorkspaceName), + } + return fmt.Sprintf("Playwright Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_checknameavailability.go new file mode 100644 index 000000000000..2310916fd5bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_checknameavailability.go @@ -0,0 +1,59 @@ +package playwrightworkspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameAvailabilityResponse +} + +// CheckNameAvailability ... +func (c PlaywrightWorkspacesClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.LoadTestService/checkNameAvailability", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CheckNameAvailabilityResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_createorupdate.go new file mode 100644 index 000000000000..6afcbb9eb6b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_createorupdate.go @@ -0,0 +1,75 @@ +package playwrightworkspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *PlaywrightWorkspace +} + +// CreateOrUpdate ... +func (c PlaywrightWorkspacesClient) CreateOrUpdate(ctx context.Context, id PlaywrightWorkspaceId, input PlaywrightWorkspace) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PlaywrightWorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id PlaywrightWorkspaceId, input PlaywrightWorkspace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_delete.go new file mode 100644 index 000000000000..c2982a7e4f42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_delete.go @@ -0,0 +1,70 @@ +package playwrightworkspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c PlaywrightWorkspacesClient) Delete(ctx context.Context, id PlaywrightWorkspaceId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PlaywrightWorkspacesClient) DeleteThenPoll(ctx context.Context, id PlaywrightWorkspaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_get.go new file mode 100644 index 000000000000..d03a6574b38e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_get.go @@ -0,0 +1,53 @@ +package playwrightworkspaces + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PlaywrightWorkspace +} + +// Get ... +func (c PlaywrightWorkspacesClient) Get(ctx context.Context, id PlaywrightWorkspaceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PlaywrightWorkspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbyresourcegroup.go new file mode 100644 index 000000000000..5c4c612dd2c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package playwrightworkspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PlaywrightWorkspace +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []PlaywrightWorkspace +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c PlaywrightWorkspacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.LoadTestService/playwrightWorkspaces", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PlaywrightWorkspace `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c PlaywrightWorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, PlaywrightWorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PlaywrightWorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate PlaywrightWorkspaceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]PlaywrightWorkspace, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbysubscription.go new file mode 100644 index 000000000000..99586cf84262 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_listbysubscription.go @@ -0,0 +1,106 @@ +package playwrightworkspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PlaywrightWorkspace +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []PlaywrightWorkspace +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c PlaywrightWorkspacesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.LoadTestService/playwrightWorkspaces", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PlaywrightWorkspace `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c PlaywrightWorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, PlaywrightWorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PlaywrightWorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate PlaywrightWorkspaceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]PlaywrightWorkspace, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_update.go new file mode 100644 index 000000000000..a456db2b3cf7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/method_update.go @@ -0,0 +1,57 @@ +package playwrightworkspaces + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PlaywrightWorkspace +} + +// Update ... +func (c PlaywrightWorkspacesClient) Update(ctx context.Context, id PlaywrightWorkspaceId, input PlaywrightWorkspaceUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PlaywrightWorkspace + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityrequest.go new file mode 100644 index 000000000000..74c4c2cd5015 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityrequest.go @@ -0,0 +1,9 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityresponse.go new file mode 100644 index 000000000000..de00902853a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_checknameavailabilityresponse.go @@ -0,0 +1,10 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResponse struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspace.go new file mode 100644 index 000000000000..d6a0d9ae9ec3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspace.go @@ -0,0 +1,18 @@ +package playwrightworkspaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspace struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *PlaywrightWorkspaceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceproperties.go new file mode 100644 index 000000000000..6643b5c03fd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceproperties.go @@ -0,0 +1,12 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspaceProperties struct { + DataplaneUri *string `json:"dataplaneUri,omitempty"` + LocalAuth *EnablementStatus `json:"localAuth,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegionalAffinity *EnablementStatus `json:"regionalAffinity,omitempty"` + WorkspaceId *string `json:"workspaceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdate.go new file mode 100644 index 000000000000..fc449ea6a981 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdate.go @@ -0,0 +1,9 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspaceUpdate struct { + Properties *PlaywrightWorkspaceUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdateproperties.go new file mode 100644 index 000000000000..2f05215509a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/model_playwrightworkspaceupdateproperties.go @@ -0,0 +1,9 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspaceUpdateProperties struct { + LocalAuth *EnablementStatus `json:"localAuth,omitempty"` + RegionalAffinity *EnablementStatus `json:"regionalAffinity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/predicates.go new file mode 100644 index 000000000000..61d12f9843e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/predicates.go @@ -0,0 +1,32 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaywrightWorkspaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p PlaywrightWorkspaceOperationPredicate) Matches(input PlaywrightWorkspace) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/version.go new file mode 100644 index 000000000000..365b13ee6b28 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces/version.go @@ -0,0 +1,10 @@ +package playwrightworkspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-09-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/playwrightworkspaces/2025-09-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 87b908200e4f..64db5ca478b1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -677,6 +677,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2024-04-13/scripts github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01 github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/loadtests github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2022-12-01/quotas +github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2025-09-01/playwrightworkspaces github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountagreements github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountassemblies github.com/hashicorp/go-azure-sdk/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations diff --git a/website/docs/d/playwright_workspace.html.markdown b/website/docs/d/playwright_workspace.html.markdown new file mode 100644 index 000000000000..e800cd619956 --- /dev/null +++ b/website/docs/d/playwright_workspace.html.markdown @@ -0,0 +1,58 @@ +--- +subcategory: "Load Test" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_playwright_workspace" +description: |- + Gets information about an existing Playwright Workspace. +--- + +# Data Source: azurerm_playwright_workspace + +Use this data source to access information about an existing Playwright Workspace. + +## Example Usage + +```hcl +data "azurerm_playwright_workspace" "example" { + name = "existing" + resource_group_name = "existing" +} + +output "id" { + value = data.azurerm_playwright_workspace.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of this Playwright Workspace. Changing this forces a new Playwright Workspace to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the Playwright Workspace exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Playwright Workspace. + +* `dataplane_uri` - The data plane service API URI of the Playwright Workspace. + +* `location` - The Azure Region where the Playwright Workspace exists. + +* `tags` - A mapping of tags assigned to the Playwright Workspace. + +* `workspace_id` - The ID in GUID format of the Playwright Workspace. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Playwright Workspace. + +## API Providers + +This data source uses the following Azure API Providers: + +* `Microsoft.LoadTestService` - 2025-09-01 diff --git a/website/docs/r/playwright_workspace.html.markdown b/website/docs/r/playwright_workspace.html.markdown new file mode 100644 index 000000000000..d2faf1341507 --- /dev/null +++ b/website/docs/r/playwright_workspace.html.markdown @@ -0,0 +1,73 @@ +--- +subcategory: "Load Test" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_playwright_workspace" +description: |- + Manages a Playwright Workspace. +--- + +# azurerm_playwright_workspace + +Manages a Playwright Workspace. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example" + location = "West Europe" +} + +resource "azurerm_playwright_workspace" "example" { + name = "example" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Playwright Workspace. + +* `resource_group_name` - (Required) The name of the Resource Group where the Playwright Workspace should exist. Changing this forces a new Playwright Workspace to be created. + +* `location` - (Required) The Azure Region where the Playwright Workspace should exist. Changing this forces a new Playwright Workspace to be created. + +--- + +* `tags` - (Optional) A mapping of tags which should be assigned to the Playwright Workspace. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Playwright Workspace. + +* `dataplane_uri` - The data plane service API URI of the Playwright Workspace. The format of URI is `https://{location}.api.playwright.microsoft.com/playwrightworkspaces/{workspace_id}`. To use the Playwright Workspace remote browsers, apply the URI according to the [documentation](https://learn.microsoft.com/en-us/azure/app-testing/playwright-workspaces/quickstart-run-end-to-end-tests?tabs=playwrightcli&pivots=playwright-test-runner#configure-the-browser-endpoint). + +* `workspace_id` - The ID in GUID format of the Playwright Workspace. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Playwright Workspace. +* `read` - (Defaults to 5 minutes) Used when retrieving the Playwright Workspace. +* `update` - (Defaults to 30 minutes) Used when updating the Playwright Workspace. +* `delete` - (Defaults to 30 minutes) Used when deleting the Playwright Workspace. + +## Import + +Playwright Workspaces can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_playwright_workspace.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.LoadTestService/playwrightWorkspaces/workspace1 +``` + +## API Providers + +This resource uses the following Azure API Providers: + +* `Microsoft.LoadTestService` - 2025-09-01