diff --git a/internal/services/workloads/registration.go b/internal/services/workloads/registration.go index dafa929d0522..46a507ad5238 100644 --- a/internal/services/workloads/registration.go +++ b/internal/services/workloads/registration.go @@ -35,6 +35,7 @@ func (r Registration) DataSources() []sdk.DataSource { // Resources returns a list of Resources supported by this Service func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ + WorkloadsSAPDiscoveryVirtualInstanceResource{}, WorkloadsSAPSingleNodeVirtualInstanceResource{}, WorkloadsSAPThreeTierVirtualInstanceResource{}, } diff --git a/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource.go b/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource.go new file mode 100644 index 000000000000..07f281f6121e --- /dev/null +++ b/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource.go @@ -0,0 +1,285 @@ +package workloads + +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/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/workloads/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type WorkloadsSAPDiscoveryVirtualInstanceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + CentralServerVmId string `tfschema:"central_server_virtual_machine_id"` + Environment string `tfschema:"environment"` + Identity []identity.ModelUserAssigned `tfschema:"identity"` + ManagedResourceGroupName string `tfschema:"managed_resource_group_name"` + ManagedStorageAccountName string `tfschema:"managed_storage_account_name"` + SapProduct string `tfschema:"sap_product"` + Tags map[string]string `tfschema:"tags"` +} + +type WorkloadsSAPDiscoveryVirtualInstanceResource struct{} + +var _ sdk.ResourceWithUpdate = WorkloadsSAPDiscoveryVirtualInstanceResource{} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) ResourceType() string { + return "azurerm_workloads_sap_discovery_virtual_instance" +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) ModelObject() interface{} { + return &WorkloadsSAPDiscoveryVirtualInstanceModel{} +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return sapvirtualinstances.ValidateSapVirtualInstanceID +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SAPVirtualInstanceName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "central_server_virtual_machine_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: commonids.ValidateVirtualMachineID, + }, + + "environment": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPEnvironmentType(), false), + }, + + "sap_product": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(sapvirtualinstances.PossibleValuesForSAPProductType(), false), + }, + + "managed_resource_group_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: resourcegroups.ValidateName, + }, + + "managed_storage_account_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: storageValidate.StorageAccountName, + }, + + "identity": commonschema.UserAssignedIdentityOptional(), + + "tags": commonschema.Tags(), + } +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model WorkloadsSAPDiscoveryVirtualInstanceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.Workloads.SAPVirtualInstances + subscriptionId := metadata.Client.Account.SubscriptionId + id := sapvirtualinstances.NewSapVirtualInstanceID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + identity, err := identity.ExpandUserAssignedMapFromModel(model.Identity) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + + parameters := &sapvirtualinstances.SAPVirtualInstance{ + Identity: identity, + Location: location.Normalize(model.Location), + Properties: sapvirtualinstances.SAPVirtualInstanceProperties{ + Environment: sapvirtualinstances.SAPEnvironmentType(model.Environment), + SapProduct: sapvirtualinstances.SAPProductType(model.SapProduct), + }, + Tags: &model.Tags, + } + + discoveryConfiguration := &sapvirtualinstances.DiscoveryConfiguration{ + CentralServerVMId: pointer.To(model.CentralServerVmId), + } + + if v := model.ManagedStorageAccountName; v != "" { + discoveryConfiguration.ManagedRgStorageAccountName = pointer.To(v) + } + + parameters.Properties.Configuration = discoveryConfiguration + + if v := model.ManagedResourceGroupName; v != "" { + parameters.Properties.ManagedResourceGroupConfiguration = &sapvirtualinstances.ManagedRGConfiguration{ + Name: utils.String(v), + } + } + + if err := client.CreateThenPoll(ctx, id, *parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model WorkloadsSAPDiscoveryVirtualInstanceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parameters := &sapvirtualinstances.UpdateSAPVirtualInstanceRequest{} + + if metadata.ResourceData.HasChange("identity") { + identityValue, err := identity.ExpandUserAssignedMap(metadata.ResourceData.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + parameters.Identity = identityValue + } + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = &model.Tags + } + + if _, err := client.Update(ctx, *id, *parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(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 := WorkloadsSAPDiscoveryVirtualInstanceModel{} + if model := resp.Model; model != nil { + state.Name = id.SapVirtualInstanceName + state.ResourceGroupName = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + + identity, err := identity.FlattenUserAssignedMapToModel(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + state.Identity = pointer.From(identity) + + props := &model.Properties + state.Environment = string(props.Environment) + state.SapProduct = string(props.SapProduct) + state.Tags = pointer.From(model.Tags) + + if config := props.Configuration; config != nil { + if v, ok := config.(sapvirtualinstances.DiscoveryConfiguration); ok { + state.CentralServerVmId = pointer.From(v.CentralServerVMId) + state.ManagedStorageAccountName = pointer.From(v.ManagedRgStorageAccountName) + } + } + + if v := props.ManagedResourceGroupConfiguration; v != nil { + state.ManagedResourceGroupName = pointer.From(v.Name) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 60 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Workloads.SAPVirtualInstances + + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(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 + }, + } +} diff --git a/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource_test.go b/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource_test.go new file mode 100644 index 000000000000..2a94b2a5ec6d --- /dev/null +++ b/internal/services/workloads/workloads_sap_discovery_virtual_instance_resource_test.go @@ -0,0 +1,248 @@ +package workloads_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/workloads/2023-04-01/sapvirtualinstances" + "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 WorkloadsSAPDiscoveryVirtualInstanceResource struct{} + +func TestAccWorkloadsSAPDiscoveryVirtualInstanceSequential(t *testing.T) { + // The dependent central server VM requires many complicated manual configurations. So it has to test based on the resource provided by service team. + if os.Getenv("ARM_TEST_SAP_VIRTUAL_INSTANCE_NAME") == "" || os.Getenv("ARM_TEST_CENTRAL_SERVER_VM_ID") == "" || os.Getenv("ARM_TEST_IDENTITY_ID") == "" { + t.Skip("Skipping as `ARM_TEST_SAP_VIRTUAL_INSTANCE_NAME`, `ARM_TEST_CENTRAL_SERVER_VM_ID` and `ARM_TEST_IDENTITY_ID` are not specified") + } + + acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ + "sapVirtualInstance": { + "basic": testAccWorkloadsSAPDiscoveryVirtualInstance_basic, + "requiresImport": testAccWorkloadsSAPDiscoveryVirtualInstance_requiresImport, + "complete": testAccWorkloadsSAPDiscoveryVirtualInstance_complete, + "update": testAccWorkloadsSAPDiscoveryVirtualInstance_update, + }, + }) +} + +func testAccWorkloadsSAPDiscoveryVirtualInstance_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_discovery_virtual_instance", "test") + r := WorkloadsSAPDiscoveryVirtualInstanceResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccWorkloadsSAPDiscoveryVirtualInstance_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_discovery_virtual_instance", "test") + r := WorkloadsSAPDiscoveryVirtualInstanceResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccWorkloadsSAPDiscoveryVirtualInstance_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_discovery_virtual_instance", "test") + r := WorkloadsSAPDiscoveryVirtualInstanceResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccWorkloadsSAPDiscoveryVirtualInstance_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_workloads_sap_discovery_virtual_instance", "test") + r := WorkloadsSAPDiscoveryVirtualInstanceResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(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 (r WorkloadsSAPDiscoveryVirtualInstanceResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := sapvirtualinstances.ParseSapVirtualInstanceID(state.ID) + if err != nil { + return nil, err + } + + client := clients.Workloads.SAPVirtualInstances + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-sapvis-%d" + location = "%s" +} + +resource "azurerm_workloads_sap_discovery_virtual_instance" "test" { + name = "%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + central_server_virtual_machine_id = "%s" + managed_storage_account_name = "acctestmanagedsa%s" + + identity { + type = "UserAssigned" + + identity_ids = [ + "%s", + ] + } + + lifecycle { + ignore_changes = [managed_resource_group_name] + } +} +`, data.RandomInteger, data.Locations.Primary, os.Getenv("ARM_TEST_SAP_VIRTUAL_INSTANCE_NAME"), os.Getenv("ARM_TEST_CENTRAL_SERVER_VM_ID"), data.RandomString, os.Getenv("ARM_TEST_IDENTITY_ID")) +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_workloads_sap_discovery_virtual_instance" "import" { + name = azurerm_workloads_sap_discovery_virtual_instance.test.name + resource_group_name = azurerm_workloads_sap_discovery_virtual_instance.test.resource_group_name + location = azurerm_workloads_sap_discovery_virtual_instance.test.location + environment = azurerm_workloads_sap_discovery_virtual_instance.test.environment + sap_product = azurerm_workloads_sap_discovery_virtual_instance.test.sap_product + central_server_virtual_machine_id = "%s" + managed_storage_account_name = "acctestmanagedsa%s" + + identity { + type = "UserAssigned" + + identity_ids = [ + "%s", + ] + } +} +`, r.basic(data), os.Getenv("ARM_TEST_CENTRAL_SERVER_VM_ID"), data.RandomString, os.Getenv("ARM_TEST_IDENTITY_ID")) +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-sapvis-%d" + location = "%s" +} + +resource "azurerm_workloads_sap_discovery_virtual_instance" "test" { + name = "%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "acctestmanagedRG%d" + central_server_virtual_machine_id = "%s" + managed_storage_account_name = "acctestmanagedsa%s" + + identity { + type = "UserAssigned" + + identity_ids = [ + "%s", + ] + } + + tags = { + env = "Test" + } +} +`, data.RandomInteger, data.Locations.Primary, os.Getenv("ARM_TEST_SAP_VIRTUAL_INSTANCE_NAME"), data.RandomInteger, os.Getenv("ARM_TEST_CENTRAL_SERVER_VM_ID"), data.RandomString, os.Getenv("ARM_TEST_IDENTITY_ID")) +} + +func (r WorkloadsSAPDiscoveryVirtualInstanceResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-sapvis-%d" + location = "%s" +} + +resource "azurerm_workloads_sap_discovery_virtual_instance" "test" { + name = "%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + environment = "NonProd" + sap_product = "S4HANA" + managed_resource_group_name = "acctestmanagedRG%d" + central_server_virtual_machine_id = "%s" + managed_storage_account_name = "acctestmanagedsa%s" + + tags = { + env = "Test2" + } +} +`, data.RandomInteger, data.Locations.Primary, os.Getenv("ARM_TEST_SAP_VIRTUAL_INSTANCE_NAME"), data.RandomInteger, os.Getenv("ARM_TEST_CENTRAL_SERVER_VM_ID"), data.RandomString) +} diff --git a/website/docs/r/workloads_sap_discovery_virtual_instance.html.markdown b/website/docs/r/workloads_sap_discovery_virtual_instance.html.markdown new file mode 100644 index 000000000000..097a45635400 --- /dev/null +++ b/website/docs/r/workloads_sap_discovery_virtual_instance.html.markdown @@ -0,0 +1,99 @@ +--- +subcategory: "Workloads" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_workloads_sap_discovery_virtual_instance" +description: |- + Manages an SAP Discovery Virtual Instance. +--- + +# azurerm_workloads_sap_discovery_virtual_instance + +Manages an SAP Discovery Virtual Instance. + +-> **Note:** Before using this resource, it's required to submit the request of registering the Resource Provider with Azure CLI `az provider register --namespace "Microsoft.Workloads"`. The Resource Provider can take a while to register, you can check the status by running `az provider show --namespace "Microsoft.Workloads" --query "registrationState"`. Once this outputs "Registered" the Resource Provider is available for use. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-sapvis" + location = "West Europe" +} + +resource "azurerm_workloads_sap_discovery_virtual_instance" "example" { + name = "X01" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + environment = "NonProd" + sap_product = "S4HANA" + central_server_virtual_machine_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/csvm1" + managed_storage_account_name = "managedsa" + + identity { + type = "UserAssigned" + + identity_ids = [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai1" + ] + } + + lifecycle { + ignore_changes = [managed_resource_group_name] + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name of the SAP Discovery Virtual Instance. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the SAP Discovery Virtual Instance should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the SAP Discovery Virtual Instance should exist. Changing this forces a new resource to be created. + +* `central_server_virtual_machine_id` - (Required) The ID of the Virtual Machine of the Central Server. Changing this forces a new resource to be created. + +* `environment` - (Required) The environment type for the SAP Discovery Virtual Instance. Possible values are `NonProd` and `Prod`. Changing this forces a new resource to be created. + +* `sap_product` - (Required) The SAP Product type for the SAP Discovery Virtual Instance. Possible values are `ECC`, `Other` and `S4HANA`. Changing this forces a new resource to be created. + +* `identity` - (Optional) An `identity` block as defined below. + +* `managed_resource_group_name` - (Optional) The name of the managed Resource Group for the SAP Discovery Virtual Instance. Changing this forces a new resource to be created. + +* `managed_storage_account_name` - (Optional) The name of the custom Storage Account created by the service in the managed Resource Group. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the SAP Discovery Virtual Instance. + +--- + +An `identity` block supports the following: + +* `type` - (Required) The type of Managed Service Identity that should be configured on this SAP Discovery Virtual Instance. The only possible value is `UserAssigned`. + +* `identity_ids` - (Required) A list of User Assigned Managed Identity IDs to be assigned to this SAP Discovery Virtual Instance. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the SAP Discovery Virtual Instance. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 60 minutes) Used when creating the SAP Discovery Virtual Instance. +* `read` - (Defaults to 5 minutes) Used when retrieving the SAP Discovery Virtual Instance. +* `update` - (Defaults to 60 minutes) Used when updating the SAP Discovery Virtual Instance. +* `delete` - (Defaults to 60 minutes) Used when deleting the SAP Discovery Virtual Instance. + +## Import + +SAP Discovery Virtual Instances can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_workloads_sap_discovery_virtual_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Workloads/sapVirtualInstances/vis1 +```