diff --git a/internal/services/appconfiguration/app_configuration_replica_resource.go b/internal/services/appconfiguration/app_configuration_replica_resource.go new file mode 100644 index 000000000000..98ea70a2f511 --- /dev/null +++ b/internal/services/appconfiguration/app_configuration_replica_resource.go @@ -0,0 +1,177 @@ +package appconfiguration + +import ( + "context" + "fmt" + "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/appconfiguration/2023-03-01/configurationstores" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "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" +) + +var _ sdk.Resource = ReplicaResource{} + +type ReplicaResource struct{} + +func (r ReplicaResource) ModelObject() interface{} { + return &ReplicaResourceSchema{} +} + +type ReplicaResourceSchema struct { + ConfigurationStoreId string `tfschema:"configuration_store_id"` + Endpoint string `tfschema:"endpoint"` + Location string `tfschema:"location"` + Name string `tfschema:"name"` +} + +func (r ReplicaResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return replicas.ValidateReplicaID +} +func (r ReplicaResource) ResourceType() string { + return "azurerm_app_configuration_replica" +} +func (r ReplicaResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "configuration_store_id": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + ValidateFunc: configurationstores.ValidateConfigurationStoreID, + }, + "location": commonschema.Location(), + "name": { + ForceNew: true, + Required: true, + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + } +} + +func (r ReplicaResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "endpoint": { + Computed: true, + Type: pluginsdk.TypeString, + }, + } +} + +func (r ReplicaResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppConfiguration.ReplicasClient + + var config ReplicaResourceSchema + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + configurationStoreId, err := configurationstores.ParseConfigurationStoreID(config.ConfigurationStoreId) + if err != nil { + return fmt.Errorf("parsing configuration store id %s: %+v", config.ConfigurationStoreId, err) + } + + id := replicas.NewReplicaID(configurationStoreId.SubscriptionId, configurationStoreId.ResourceGroupName, configurationStoreId.ConfigurationStoreName, config.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + payload := replicas.Replica{ + Location: pointer.To(config.Location), + Name: pointer.To(config.Name), + } + + // concurrent creation of replicas under one configuration store will fail + locks.ByName(id.ConfigurationStoreName, r.ResourceType()) + defer locks.UnlockByName(id.ConfigurationStoreName, r.ResourceType()) + + if err = client.CreateThenPoll(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ReplicaResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppConfiguration.ReplicasClient + + id, err := replicas.ParseReplicaID(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) + } + + if resp.Model == nil { + return fmt.Errorf("unexpected nil model for %s", *id) + } + if resp.Model.Properties == nil { + return fmt.Errorf("unexpected nil properties for %s", *id) + } + if resp.Model.Location == nil { + return fmt.Errorf("unexpected nil location for %s", *id) + } + + schema := ReplicaResourceSchema{ + ConfigurationStoreId: configurationstores.NewConfigurationStoreID(id.SubscriptionId, id.ResourceGroupName, id.ConfigurationStoreName).ID(), + Endpoint: pointer.From(resp.Model.Properties.Endpoint), + Location: location.Normalize(*resp.Model.Location), + Name: id.ReplicaName, + } + + return metadata.Encode(&schema) + }, + } +} + +func (r ReplicaResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppConfiguration.ReplicasClient + + id, err := replicas.ParseReplicaID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + locks.ByName(id.ConfigurationStoreName, r.ResourceType()) + defer locks.UnlockByName(id.ConfigurationStoreName, r.ResourceType()) + + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/appconfiguration/app_configuration_replica_resource_test.go b/internal/services/appconfiguration/app_configuration_replica_resource_test.go new file mode 100644 index 000000000000..dd2b6bbca4aa --- /dev/null +++ b/internal/services/appconfiguration/app_configuration_replica_resource_test.go @@ -0,0 +1,145 @@ +package appconfiguration_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas" + "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" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type AppConfigurationReplicaTestResource struct{} + +func TestAccAppConfigurationReplica_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_configuration_replica", "test") + r := AppConfigurationReplicaTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccAppConfigurationReplica_multiple(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_configuration_replica", "test") + r := AppConfigurationReplicaTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.multiple(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccAppConfigurationReplica_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_configuration_replica", "test") + r := AppConfigurationReplicaTestResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r AppConfigurationReplicaTestResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := replicas.ParseReplicaID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.AppConfiguration.ReplicasClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading %s: %+v", *id, err) + } + + return utils.Bool(resp.Model != nil), nil +} + +func (r AppConfigurationReplicaTestResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_app_configuration_replica" "test" { + configuration_store_id = azurerm_app_configuration.test.id + location = local.secondary_location + name = "replica1" +} +`, r.template(data)) +} + +func (r AppConfigurationReplicaTestResource) multiple(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_app_configuration_replica" "test" { + configuration_store_id = azurerm_app_configuration.test.id + location = local.secondary_location + name = "replica1" +} + +resource "azurerm_app_configuration_replica" "test1" { + configuration_store_id = azurerm_app_configuration.test.id + location = local.ternary_location + name = "replica2" +} +`, r.template(data)) +} + +func (r AppConfigurationReplicaTestResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_app_configuration_replica" "import" { + configuration_store_id = azurerm_app_configuration_replica.test.configuration_store_id + location = azurerm_app_configuration_replica.test.location + name = azurerm_app_configuration_replica.test.name +} +`, r.basic(data)) +} + +func (r AppConfigurationReplicaTestResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +locals { + random_integer = %[1]d + primary_location = %[2]q + secondary_location = %[3]q + ternary_location = %[4]q +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-appconfig-replica-${local.random_integer}" + location = local.primary_location +} + +resource "azurerm_app_configuration" "test" { + name = "testappconf${local.random_integer}" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku = "standard" + soft_delete_retention_days = 1 +} +`, data.RandomInteger, data.Locations.Primary, data.Locations.Secondary, data.Locations.Ternary) +} diff --git a/internal/services/appconfiguration/client/client.go b/internal/services/appconfiguration/client/client.go index e7fb06f429de..fbf59eb548ba 100644 --- a/internal/services/appconfiguration/client/client.go +++ b/internal/services/appconfiguration/client/client.go @@ -1,14 +1,13 @@ package client import ( - "context" "fmt" "github.com/Azure/go-autorest/autorest" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/configurationstores" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores" "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/operations" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas" authWrapper "github.com/hashicorp/go-azure-sdk/sdk/auth/autorest" "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" @@ -20,6 +19,7 @@ type Client struct { ConfigurationStoresClient *configurationstores.ConfigurationStoresClient DeletedConfigurationStoresClient *deletedconfigurationstores.DeletedConfigurationStoresClient OperationsClient *operations.OperationsClient + ReplicasClient *replicas.ReplicasClient authorizerFunc common.ApiAuthorizerFunc configureClientFunc func(c *autorest.Client, authorizer autorest.Authorizer) } @@ -51,73 +51,6 @@ func (c Client) LinkWorkaroundDataPlaneClientWithEndpoint(configurationStoreEndp return &workaroundClient, nil } -func (c Client) DataPlaneClient(ctx context.Context, configurationStoreId string) (*appconfiguration.BaseClient, error) { - appConfigId, err := configurationstores.ParseConfigurationStoreID(configurationStoreId) - if err != nil { - return nil, err - } - - // TODO: caching all of this - appConfig, err := c.ConfigurationStoresClient.Get(ctx, *appConfigId) - if err != nil { - if response.WasNotFound(appConfig.HttpResponse) { - return nil, nil - } - - return nil, err - } - - if appConfig.Model == nil || appConfig.Model.Properties == nil || appConfig.Model.Properties.Endpoint == nil { - return nil, fmt.Errorf("endpoint was nil") - } - - endpoint := *appConfig.Model.Properties.Endpoint - - api := environments.NewApiEndpoint("AppConfiguration", endpoint, nil) - appConfigAuth, err := c.authorizerFunc(api) - if err != nil { - return nil, fmt.Errorf("obtaining auth token for %q: %+v", endpoint, err) - } - - client := appconfiguration.NewWithoutDefaults("", endpoint) - c.configureClientFunc(&client.Client, authWrapper.AutorestAuthorizer(appConfigAuth)) - - return &client, nil -} - -func (c Client) LinkWorkaroundDataPlaneClient(ctx context.Context, configurationStoreId string) (*azuresdkhacks.DataPlaneClient, error) { - appConfigId, err := configurationstores.ParseConfigurationStoreID(configurationStoreId) - if err != nil { - return nil, err - } - - // TODO: caching all of this - appConfig, err := c.ConfigurationStoresClient.Get(ctx, *appConfigId) - if err != nil { - if response.WasNotFound(appConfig.HttpResponse) { - return nil, nil - } - - return nil, err - } - - if appConfig.Model == nil || appConfig.Model.Properties == nil || appConfig.Model.Properties.Endpoint == nil { - return nil, fmt.Errorf("endpoint was nil") - } - - api := environments.NewApiEndpoint("AppConfiguration", *appConfig.Model.Properties.Endpoint, nil) - appConfigAuth, err := c.authorizerFunc(api) - if err != nil { - return nil, fmt.Errorf("obtaining auth token for %q: %+v", *appConfig.Model.Properties.Endpoint, err) - } - - client := appconfiguration.NewWithoutDefaults("", *appConfig.Model.Properties.Endpoint) - c.configureClientFunc(&client.Client, authWrapper.AutorestAuthorizer(appConfigAuth)) - workaroundClient := azuresdkhacks.NewDataPlaneClient(client) - - return &workaroundClient, nil -} - func NewClient(o *common.ClientOptions) (*Client, error) { configurationStores, err := configurationstores.NewConfigurationStoresClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -137,10 +70,17 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(operationsClient.Client, o.Authorizers.ResourceManager) + replicasClient, err := replicas.NewReplicasClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building DeletedConfigurationStores client: %+v", err) + } + o.Configure(replicasClient.Client, o.Authorizers.ResourceManager) + return &Client{ ConfigurationStoresClient: configurationStores, DeletedConfigurationStoresClient: deletedConfigurationStores, OperationsClient: operationsClient, + ReplicasClient: replicasClient, authorizerFunc: o.Authorizers.AuthorizerFunc, configureClientFunc: o.ConfigureClient, }, nil diff --git a/internal/services/appconfiguration/registration.go b/internal/services/appconfiguration/registration.go index 733ef8f138b8..f61fcc65d9fd 100644 --- a/internal/services/appconfiguration/registration.go +++ b/internal/services/appconfiguration/registration.go @@ -27,6 +27,7 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ KeyResource{}, FeatureResource{}, + ReplicaResource{}, } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/README.md new file mode 100644 index 000000000000..2e4d4d60eb24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas` Documentation + +The `replicas` SDK allows for interaction with the Azure Resource Manager Service `appconfiguration` (API Version `2023-03-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-sdk/resource-manager/appconfiguration/2023-03-01/replicas" +``` + + +### Client Initialization + +```go +client := replicas.NewReplicasClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ReplicasClient.Create` + +```go +ctx := context.TODO() +id := replicas.NewReplicaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue", "replicaValue") + +payload := replicas.Replica{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ReplicasClient.Delete` + +```go +ctx := context.TODO() +id := replicas.NewReplicaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue", "replicaValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ReplicasClient.Get` + +```go +ctx := context.TODO() +id := replicas.NewReplicaID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue", "replicaValue") + +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: `ReplicasClient.ListByConfigurationStore` + +```go +ctx := context.TODO() +id := replicas.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configurationStoreValue") + +// alternatively `client.ListByConfigurationStore(ctx, id)` can be used to do batched pagination +items, err := client.ListByConfigurationStoreComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/client.go new file mode 100644 index 000000000000..084e9f434364 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/client.go @@ -0,0 +1,26 @@ +package replicas + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "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 ReplicasClient struct { + Client *resourcemanager.Client +} + +func NewReplicasClientWithBaseURI(api environments.Api) (*ReplicasClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "replicas", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReplicasClient: %+v", err) + } + + return &ReplicasClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/constants.go new file mode 100644 index 000000000000..2a2698617064 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/constants.go @@ -0,0 +1,60 @@ +package replicas + +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 ReplicaProvisioningState string + +const ( + ReplicaProvisioningStateCanceled ReplicaProvisioningState = "Canceled" + ReplicaProvisioningStateCreating ReplicaProvisioningState = "Creating" + ReplicaProvisioningStateDeleting ReplicaProvisioningState = "Deleting" + ReplicaProvisioningStateFailed ReplicaProvisioningState = "Failed" + ReplicaProvisioningStateSucceeded ReplicaProvisioningState = "Succeeded" +) + +func PossibleValuesForReplicaProvisioningState() []string { + return []string{ + string(ReplicaProvisioningStateCanceled), + string(ReplicaProvisioningStateCreating), + string(ReplicaProvisioningStateDeleting), + string(ReplicaProvisioningStateFailed), + string(ReplicaProvisioningStateSucceeded), + } +} + +func (s *ReplicaProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReplicaProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseReplicaProvisioningState(input string) (*ReplicaProvisioningState, error) { + vals := map[string]ReplicaProvisioningState{ + "canceled": ReplicaProvisioningStateCanceled, + "creating": ReplicaProvisioningStateCreating, + "deleting": ReplicaProvisioningStateDeleting, + "failed": ReplicaProvisioningStateFailed, + "succeeded": ReplicaProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReplicaProvisioningState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go new file mode 100644 index 000000000000..64c7ad6a2440 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go @@ -0,0 +1,127 @@ +package replicas + +import ( + "fmt" + "strings" + + "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. + +var _ resourceids.ResourceId = ConfigurationStoreId{} + +// ConfigurationStoreId is a struct representing the Resource ID for a Configuration Store +type ConfigurationStoreId struct { + SubscriptionId string + ResourceGroupName string + ConfigurationStoreName string +} + +// NewConfigurationStoreID returns a new ConfigurationStoreId struct +func NewConfigurationStoreID(subscriptionId string, resourceGroupName string, configurationStoreName string) ConfigurationStoreId { + return ConfigurationStoreId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ConfigurationStoreName: configurationStoreName, + } +} + +// ParseConfigurationStoreID parses 'input' into a ConfigurationStoreId +func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationStoreId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationStoreId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + } + + return &id, nil +} + +// ParseConfigurationStoreIDInsensitively parses 'input' case-insensitively into a ConfigurationStoreId +// note: this method should only be used for API response data and not user input +func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationStoreId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationStoreId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + } + + return &id, nil +} + +// ValidateConfigurationStoreID checks that 'input' can be parsed as a Configuration Store ID +func ValidateConfigurationStoreID(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 := ParseConfigurationStoreID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration Store ID +func (id ConfigurationStoreId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppConfiguration/configurationStores/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ConfigurationStoreName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration Store ID +func (id ConfigurationStoreId) 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("staticMicrosoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), + resourceids.StaticSegment("staticConfigurationStores", "configurationStores", "configurationStores"), + resourceids.UserSpecifiedSegment("configurationStoreName", "configurationStoreValue"), + } +} + +// String returns a human-readable description of this Configuration Store ID +func (id ConfigurationStoreId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Configuration Store Name: %q", id.ConfigurationStoreName), + } + return fmt.Sprintf("Configuration Store (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go new file mode 100644 index 000000000000..464e8bae7e91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go @@ -0,0 +1,140 @@ +package replicas + +import ( + "fmt" + "strings" + + "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. + +var _ resourceids.ResourceId = ReplicaId{} + +// ReplicaId is a struct representing the Resource ID for a Replica +type ReplicaId struct { + SubscriptionId string + ResourceGroupName string + ConfigurationStoreName string + ReplicaName string +} + +// NewReplicaID returns a new ReplicaId struct +func NewReplicaID(subscriptionId string, resourceGroupName string, configurationStoreName string, replicaName string) ReplicaId { + return ReplicaId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ConfigurationStoreName: configurationStoreName, + ReplicaName: replicaName, + } +} + +// ParseReplicaID parses 'input' into a ReplicaId +func ParseReplicaID(input string) (*ReplicaId, error) { + parser := resourceids.NewParserFromResourceIdType(ReplicaId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ReplicaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + } + + if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + } + + return &id, nil +} + +// ParseReplicaIDInsensitively parses 'input' case-insensitively into a ReplicaId +// note: this method should only be used for API response data and not user input +func ParseReplicaIDInsensitively(input string) (*ReplicaId, error) { + parser := resourceids.NewParserFromResourceIdType(ReplicaId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ReplicaId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + } + + if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + } + + return &id, nil +} + +// ValidateReplicaID checks that 'input' can be parsed as a Replica ID +func ValidateReplicaID(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 := ParseReplicaID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Replica ID +func (id ReplicaId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppConfiguration/configurationStores/%s/replicas/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ConfigurationStoreName, id.ReplicaName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Replica ID +func (id ReplicaId) 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("staticMicrosoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), + resourceids.StaticSegment("staticConfigurationStores", "configurationStores", "configurationStores"), + resourceids.UserSpecifiedSegment("configurationStoreName", "configurationStoreValue"), + resourceids.StaticSegment("staticReplicas", "replicas", "replicas"), + resourceids.UserSpecifiedSegment("replicaName", "replicaValue"), + } +} + +// String returns a human-readable description of this Replica ID +func (id ReplicaId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Configuration Store Name: %q", id.ConfigurationStoreName), + fmt.Sprintf("Replica Name: %q", id.ReplicaName), + } + return fmt.Sprintf("Replica (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_create.go new file mode 100644 index 000000000000..d9774267ac91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_create.go @@ -0,0 +1,74 @@ +package replicas + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Create ... +func (c ReplicasClient) Create(ctx context.Context, id ReplicaId, input Replica) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + 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 +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ReplicasClient) CreateThenPoll(ctx context.Context, id ReplicaId, input Replica) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_delete.go new file mode 100644 index 000000000000..68fe181f8c39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_delete.go @@ -0,0 +1,71 @@ +package replicas + +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 ReplicasClient) Delete(ctx context.Context, id ReplicaId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + 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 ReplicasClient) DeleteThenPoll(ctx context.Context, id ReplicaId) 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/appconfiguration/2023-03-01/replicas/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_get.go new file mode 100644 index 000000000000..86f7742e95dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_get.go @@ -0,0 +1,51 @@ +package replicas + +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 *Replica +} + +// Get ... +func (c ReplicasClient) Get(ctx context.Context, id ReplicaId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_listbyconfigurationstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_listbyconfigurationstore.go new file mode 100644 index 000000000000..eafe2251a0a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/method_listbyconfigurationstore.go @@ -0,0 +1,89 @@ +package replicas + +import ( + "context" + "fmt" + "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 ListByConfigurationStoreOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Replica +} + +type ListByConfigurationStoreCompleteResult struct { + Items []Replica +} + +// ListByConfigurationStore ... +func (c ReplicasClient) ListByConfigurationStore(ctx context.Context, id ConfigurationStoreId) (result ListByConfigurationStoreOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/replicas", 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 *[]Replica `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByConfigurationStoreComplete retrieves all the results into a single object +func (c ReplicasClient) ListByConfigurationStoreComplete(ctx context.Context, id ConfigurationStoreId) (ListByConfigurationStoreCompleteResult, error) { + return c.ListByConfigurationStoreCompleteMatchingPredicate(ctx, id, ReplicaOperationPredicate{}) +} + +// ListByConfigurationStoreCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReplicasClient) ListByConfigurationStoreCompleteMatchingPredicate(ctx context.Context, id ConfigurationStoreId, predicate ReplicaOperationPredicate) (result ListByConfigurationStoreCompleteResult, err error) { + items := make([]Replica, 0) + + resp, err := c.ListByConfigurationStore(ctx, id) + if err != nil { + 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 = ListByConfigurationStoreCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replica.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replica.go new file mode 100644 index 000000000000..95deda8039b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replica.go @@ -0,0 +1,17 @@ +package replicas + +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 Replica struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ReplicaProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replicaproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replicaproperties.go new file mode 100644 index 000000000000..361a71b2a0d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/model_replicaproperties.go @@ -0,0 +1,9 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicaProperties struct { + Endpoint *string `json:"endpoint,omitempty"` + ProvisioningState *ReplicaProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/predicates.go new file mode 100644 index 000000000000..9dd3706f57c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/predicates.go @@ -0,0 +1,32 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicaOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ReplicaOperationPredicate) Matches(input Replica) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.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/appconfiguration/2023-03-01/replicas/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/version.go new file mode 100644 index 000000000000..198b0d4d213b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas/version.go @@ -0,0 +1,12 @@ +package replicas + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/replicas/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0d151f241c79..561b7559cad3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -151,6 +151,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/apimanagement/2021-08-01/sche github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/configurationstores github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/operations +github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis diff --git a/website/docs/r/app_configuration_replica.html.markdown b/website/docs/r/app_configuration_replica.html.markdown new file mode 100644 index 000000000000..0b1857015d7b --- /dev/null +++ b/website/docs/r/app_configuration_replica.html.markdown @@ -0,0 +1,70 @@ +--- +subcategory: "App Configuration" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_app_configuration_replica" +description: |- + Manages a App Configuration Replica. + +--- + +# azurerm_app_configuration_replica + +Manages an App Configuration Replica. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_app_configuration" "example" { + name = "example-app-conf" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku = "standard" +} + +resource "azurerm_app_configuration_replica" "example" { + configuration_store_id = azurerm_app_configuration.example.id + location = azurerm_resource_group.example.location + name = "example" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `configuration_store_id` - (Required) Specifies the ID of the Configuration Store within which this App Configuration Replica should exist. Changing this forces a new App Configuration Replica to be created. + +* `location` - (Required) The Azure Region where the App Configuration Replica should exist. Changing this forces a new App Configuration Replica to be created. + +* `name` - (Required) Specifies the name of this App Configuration Replica. Changing this forces a new App Configuration Replica to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the App Configuration Replica. + +* `endpoint` - The URI of the replica where the replica API will be available. + +--- + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating this App Configuration Replica. +* `delete` - (Defaults to 30 minutes) Used when deleting this App Configuration Replica. +* `read` - (Defaults to 5 minutes) Used when retrieving this App Configuration Replica. + +## Import + +An existing App Configuration Replica can be imported into Terraform using the `resource id`, e.g. + +```shell +terraform import azurerm_app_configuration_replica.example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configurationStoreName}/replicas/{replicaName} +```