diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 93aa7ae0a448..f74a85240265 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -343,7 +343,7 @@ service/synapse: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_synapse_((.|\n)*)###' service/systemcentervirtualmachinemanager: - - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_system_center_virtual_machine_manager_server((.|\n)*)###' + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_system_center_virtual_machine_manager_((.|\n)*)###' service/traffic-manager: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_traffic_manager_((.|\n)*)###' diff --git a/internal/services/systemcentervirtualmachinemanager/registration.go b/internal/services/systemcentervirtualmachinemanager/registration.go index 2ac8fef8b82e..624d5abf2c87 100644 --- a/internal/services/systemcentervirtualmachinemanager/registration.go +++ b/internal/services/systemcentervirtualmachinemanager/registration.go @@ -31,5 +31,6 @@ func (r Registration) DataSources() []sdk.DataSource { func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ SystemCenterVirtualMachineManagerServerResource{}, + SystemCenterVirtualMachineManagerAvailabilitySetResource{}, } } diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go new file mode 100644 index 000000000000..3ca3126bf673 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource.go @@ -0,0 +1,212 @@ +package systemcentervirtualmachinemanager + +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/extendedlocation/2021-08-15/customlocations" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SystemCenterVirtualMachineManagerAvailabilitySetModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + CustomLocationId string `tfschema:"custom_location_id"` + SystemCenterVirtualMachineManagerServerId string `tfschema:"system_center_virtual_machine_manager_server_id"` + Tags map[string]string `tfschema:"tags"` +} + +var _ sdk.Resource = SystemCenterVirtualMachineManagerAvailabilitySetResource{} +var _ sdk.ResourceWithUpdate = SystemCenterVirtualMachineManagerAvailabilitySetResource{} + +type SystemCenterVirtualMachineManagerAvailabilitySetResource struct{} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) ModelObject() interface{} { + return &SystemCenterVirtualMachineManagerAvailabilitySetModel{} +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return availabilitysets.ValidateAvailabilitySetID +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) ResourceType() string { + return "azurerm_system_center_virtual_machine_manager_availability_set" +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SystemCenterVirtualMachineManagerAvailabilitySetName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "custom_location_id": commonschema.ResourceIDReferenceRequiredForceNew(&customlocations.CustomLocationId{}), + + "system_center_virtual_machine_manager_server_id": commonschema.ResourceIDReferenceRequiredForceNew(&vmmservers.VMmServerId{}), + + "tags": commonschema.Tags(), + } +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + subscriptionId := metadata.Client.Account.SubscriptionId + client := metadata.Client.SystemCenterVirtualMachineManager.AvailabilitySets + + var model SystemCenterVirtualMachineManagerAvailabilitySetModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + scvmmServerId, err := vmmservers.ParseVMmServerID(model.SystemCenterVirtualMachineManagerServerId) + if err != nil { + return err + } + + id := availabilitysets.NewAvailabilitySetID(subscriptionId, model.ResourceGroupName, model.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) + } + + parameters := availabilitysets.AvailabilitySet{ + Location: location.Normalize(model.Location), + ExtendedLocation: availabilitysets.ExtendedLocation{ + Type: utils.String("customLocation"), + Name: utils.String(model.CustomLocationId), + }, + Properties: availabilitysets.AvailabilitySetProperties{ + AvailabilitySetName: utils.String(id.AvailabilitySetName), + VMmServerId: utils.String(scvmmServerId.ID()), + }, + Tags: pointer.To(model.Tags), + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.AvailabilitySets + + id, err := availabilitysets.ParseAvailabilitySetID(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 := SystemCenterVirtualMachineManagerAvailabilitySetModel{} + if model := resp.Model; model != nil { + state.Name = id.AvailabilitySetName + state.ResourceGroupName = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) + state.Tags = pointer.From(model.Tags) + + scvmmServerId, err := vmmservers.ParseVMmServerIDInsensitively(pointer.From(model.Properties.VMmServerId)) + if err != nil { + return err + } + state.SystemCenterVirtualMachineManagerServerId = scvmmServerId.ID() + } + + return metadata.Encode(&state) + }, + } +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.AvailabilitySets + + id, err := availabilitysets.ParseAvailabilitySetID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SystemCenterVirtualMachineManagerAvailabilitySetModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parameters := availabilitysets.ResourcePatch{} + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = pointer.To(model.Tags) + } + + if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.AvailabilitySets + + id, err := availabilitysets.ParseAvailabilitySetID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id, availabilitysets.DeleteOperationOptions{Force: pointer.To(availabilitysets.ForceTrue)}); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go new file mode 100644 index 000000000000..6f81943dc9f4 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_availability_set_resource_test.go @@ -0,0 +1,224 @@ +package systemcentervirtualmachinemanager_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" + "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 SystemCenterVirtualMachineManagerAvailabilitySetResource struct{} + +func TestAccSystemCenterVirtualMachineManagerAvailabilitySetSequential(t *testing.T) { + // NOTE: this is a combined test rather than separate split out tests because only one System Center Virtual Machine Manager Server can be onboarded at a time on a given Custom Location + + if os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID") == "" || os.Getenv("ARM_TEST_FQDN") == "" || os.Getenv("ARM_TEST_USERNAME") == "" || os.Getenv("ARM_TEST_PASSWORD") == "" { + t.Skip("Skipping as one of `ARM_TEST_CUSTOM_LOCATION_ID`, `ARM_TEST_FQDN`, `ARM_TEST_USERNAME`, `ARM_TEST_PASSWORD` was not specified") + } + + acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ + "scvmmAvailabilitySet": { + "basic": testAccSystemCenterVirtualMachineManagerAvailabilitySet_basic, + "requiresImport": testAccSystemCenterVirtualMachineManagerAvailabilitySet_requiresImport, + "complete": testAccSystemCenterVirtualMachineManagerAvailabilitySet_complete, + "update": testAccSystemCenterVirtualMachineManagerAvailabilitySet_update, + }, + }) +} + +func testAccSystemCenterVirtualMachineManagerAvailabilitySet_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_availability_set", "test") + r := SystemCenterVirtualMachineManagerAvailabilitySetResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccSystemCenterVirtualMachineManagerAvailabilitySet_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_availability_set", "test") + r := SystemCenterVirtualMachineManagerAvailabilitySetResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func testAccSystemCenterVirtualMachineManagerAvailabilitySet_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_availability_set", "test") + r := SystemCenterVirtualMachineManagerAvailabilitySetResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func testAccSystemCenterVirtualMachineManagerAvailabilitySet_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_availability_set", "test") + r := SystemCenterVirtualMachineManagerAvailabilitySetResource{} + + data.ResourceSequentialTest(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(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := availabilitysets.ParseAvailabilitySetID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.SystemCenterVirtualMachineManager.AvailabilitySets.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading %s: %+v", *id, err) + } + + return utils.Bool(resp.Model != nil), nil +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_availability_set" "test" { + name = "acctest-scvmmas-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id + system_center_virtual_machine_manager_server_id = azurerm_system_center_virtual_machine_manager_server.test.id +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_availability_set" "import" { + name = azurerm_system_center_virtual_machine_manager_availability_set.test.name + resource_group_name = azurerm_system_center_virtual_machine_manager_availability_set.test.resource_group_name + location = azurerm_system_center_virtual_machine_manager_availability_set.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_availability_set.test.custom_location_id + system_center_virtual_machine_manager_server_id = azurerm_system_center_virtual_machine_manager_availability_set.test.system_center_virtual_machine_manager_server_id +} +`, r.basic(data)) +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_availability_set" "test" { + name = "acctest-scvmmas-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id + system_center_virtual_machine_manager_server_id = azurerm_system_center_virtual_machine_manager_server.test.id + + tags = { + env = "Test" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + features {} +} + +resource "azurerm_system_center_virtual_machine_manager_availability_set" "test" { + name = "acctest-scvmmas-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id + system_center_virtual_machine_manager_server_id = azurerm_system_center_virtual_machine_manager_server.test.id + + tags = { + env = "Test2" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerAvailabilitySetResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-scvmmas-%d" + location = "%s" +} + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%s" + fqdn = "%s" + username = "%s" + password = "%s" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name.go new file mode 100644 index 000000000000..720818f9013d --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name.go @@ -0,0 +1,20 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func SystemCenterVirtualMachineManagerAvailabilitySetName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if !regexp.MustCompile("^[a-zA-Z0-9]([-.a-zA-Z0-9]{0,52}[a-zA-Z0-9])?$").MatchString(v) { + errors = append(errors, fmt.Errorf("%q must start and end with an alphanumeric character, may contain alphanumeric characters, dashes or periods and must be between 1 and 54 characters long", k)) + } + + return warnings, errors +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name_test.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name_test.go new file mode 100644 index 000000000000..b64b15faedb6 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_availability_set_name_test.go @@ -0,0 +1,58 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestSystemCenterVirtualMachineManagerAvailabilitySetName(t *testing.T) { + testCases := []struct { + Input string + Expected bool + }{ + { + Input: "", + Expected: false, + }, + { + Input: "a", + Expected: true, + }, + { + Input: "a8a", + Expected: true, + }, + { + Input: "a-8.a", + Expected: true, + }, + { + Input: "a-", + Expected: false, + }, + { + Input: "a.", + Expected: false, + }, + { + Input: strings.Repeat("s", 53), + Expected: true, + }, + { + Input: strings.Repeat("s", 54), + Expected: true, + }, + { + Input: strings.Repeat("s", 55), + Expected: false, + }, + } + + for _, v := range testCases { + _, errors := SystemCenterVirtualMachineManagerAvailabilitySetName(v.Input, "name") + result := len(errors) == 0 + if result != v.Expected { + t.Fatalf("Expected the result to be %t but got %t (and %d errors)", v.Expected, result, len(errors)) + } + } +} diff --git a/website/docs/r/system_center_virtual_machine_manager_availability_set.html.markdown b/website/docs/r/system_center_virtual_machine_manager_availability_set.html.markdown new file mode 100644 index 000000000000..c82227a556b3 --- /dev/null +++ b/website/docs/r/system_center_virtual_machine_manager_availability_set.html.markdown @@ -0,0 +1,79 @@ +--- +subcategory: "System Center Virtual Machine Manager" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_system_center_virtual_machine_manager_availability_set" +description: |- + Manages a System Center Virtual Machine Manager Availability Set. +--- + +# azurerm_system_center_virtual_machine_manager_availability_set + +Manages a System Center Virtual Machine Manager Availability Set. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_system_center_virtual_machine_manager_server" "example" { + name = "example-scvmmms" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + custom_location_id = "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" + fqdn = "example.labtest" + username = "testUser" + password = "H@Sh1CoR3!" +} + +resource "azurerm_system_center_virtual_machine_manager_availability_set" "example" { + name = "example-scvmmas" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.example.custom_location_id + system_center_virtual_machine_manager_server_id = azurerm_system_center_virtual_machine_manager_server.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the System Center Virtual Machine Manager Availability Set. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the System Center Virtual Machine Availability Set should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the System Center Virtual Machine Manager Availability Set should exist. Changing this forces a new resource to be created. + +* `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Availability Set. Changing this forces a new resource to be created. + +* `system_center_virtual_machine_manager_server_id` - (Required) The ID of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Availability Set. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the System Center Virtual Machine Manager Availability Set. + +--- + +## 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 System Center Virtual Machine Manager Availability Set. +* `read` - (Defaults to 5 minutes) Used when retrieving this System Center Virtual Machine Manager Availability Set. +* `update` - (Defaults to 30 minutes) Used when updating this System Center Virtual Machine Manager Availability Set. +* `delete` - (Defaults to 30 minutes) Used when deleting this System Center Virtual Machine Manager Availability Set. + +## Import + +System Center Virtual Machine Manager Availability Sets can be imported into Terraform using the `resource id`, e.g. + +```shell +terraform import azurerm_system_center_virtual_machine_manager_availability_set.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.ScVmm/availabilitySets/availabilitySet1 +```