diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml
index a43420eca78f..c23d25b6ec2b 100644
--- a/.github/labeler-issue-triage.yml
+++ b/.github/labeler-issue-triage.yml
@@ -74,6 +74,9 @@ service/cognitive-services:
service/communication:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(communication_service|email_communication_service|gallery_application|orchestrated_virtual_machine_scale_set\W+|restore_point_collection|virtual_machine_gallery_application_assignment\W+|virtual_machine_implicit_data_disk_from_source\W+|virtual_machine_restore_point\W+|virtual_machine_restore_point_collection\W+|virtual_machine_run_command\W+)((.|\n)*)###'
+service/compute-fleet:
+ - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_compute_fleet((.|\n)*)###'
+
service/connections:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(api_connection|managed_api)((.|\n)*)###'
diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml
index f2a786bebfa9..a0862c53b0b4 100644
--- a/.github/labeler-pull-request-triage.yml
+++ b/.github/labeler-pull-request-triage.yml
@@ -123,6 +123,11 @@ service/communication:
- any-glob-to-any-file:
- internal/services/communication/**/*
+service/compute-fleet:
+- changed-files:
+ - any-glob-to-any-file:
+ - internal/services/computefleet/**/*
+
service/connections:
- changed-files:
- any-glob-to-any-file:
diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt
index 9d296b6a355b..1a4b2821cb9e 100644
--- a/.teamcity/components/generated/services.kt
+++ b/.teamcity/components/generated/services.kt
@@ -26,6 +26,7 @@ var services = mapOf(
"cognitive" to "Cognitive Services",
"communication" to "Communication",
"compute" to "Compute",
+ "computefleet" to "Compute Fleet",
"confidentialledger" to "Confidential Ledger",
"connections" to "Connections",
"consumption" to "Consumption",
diff --git a/internal/clients/client.go b/internal/clients/client.go
index 1c2f60354183..2fda916ceb36 100644
--- a/internal/clients/client.go
+++ b/internal/clients/client.go
@@ -6,6 +6,7 @@ package clients
import (
"context"
"fmt"
+ computeFleet "github.com/hashicorp/terraform-provider-azurerm/internal/services/computefleet/client"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/validation"
@@ -182,6 +183,7 @@ type Client struct {
Cognitive *cognitiveServices.Client
Communication *communication.Client
Compute *compute.Client
+ ComputeFleet *computeFleet.Client
ConfidentialLedger *confidentialledger.Client
Connections *connections.Client
Consumption *consumption.Client
@@ -370,9 +372,13 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.Compute, err = compute.NewClient(o); err != nil {
return fmt.Errorf("building clients for Compute: %+v", err)
}
+ if client.ComputeFleet, err = computeFleet.NewClient(o); err != nil {
+ return fmt.Errorf("building clients for Compute Fleet: %+v", err)
+ }
if client.ConfidentialLedger, err = confidentialledger.NewClient(o); err != nil {
return fmt.Errorf("building clients for ConfidentialLedger: %+v", err)
}
+
if client.Connections, err = connections.NewClient(o); err != nil {
return fmt.Errorf("building clients for Connections: %+v", err)
}
diff --git a/internal/provider/services.go b/internal/provider/services.go
index 8e5e45fa358f..3dea86593b72 100644
--- a/internal/provider/services.go
+++ b/internal/provider/services.go
@@ -28,6 +28,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/communication"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/services/computefleet"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/connections"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption"
@@ -157,6 +158,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
cognitive.Registration{},
communication.Registration{},
compute.Registration{},
+ computefleet.Registration{},
consumption.Registration{},
containerapps.Registration{},
cosmos.Registration{},
diff --git a/internal/services/computefleet/client/client.go b/internal/services/computefleet/client/client.go
new file mode 100644
index 000000000000..f7c3b2d98c8c
--- /dev/null
+++ b/internal/services/computefleet/client/client.go
@@ -0,0 +1,24 @@
+package client
+
+import (
+ "fmt"
+
+ "github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/common"
+)
+
+type Client struct {
+ ComputeFleetClient *fleets.FleetsClient
+}
+
+func NewClient(o *common.ClientOptions) (*Client, error) {
+ computeFleetsClient, err := fleets.NewFleetsClientWithBaseURI(o.Environment.ResourceManager)
+ if err != nil {
+ return nil, fmt.Errorf("building compute fleet client: %+v", err)
+ }
+ o.Configure(computeFleetsClient.Client, o.Authorizers.ResourceManager)
+
+ return &Client{
+ ComputeFleetClient: computeFleetsClient,
+ }, nil
+}
diff --git a/internal/services/computefleet/compute_fleet_resource.go b/internal/services/computefleet/compute_fleet_resource.go
new file mode 100644
index 000000000000..6e5e1e3637af
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource.go
@@ -0,0 +1,1820 @@
+package computefleet
+
+import (
+ "context"
+ "fmt"
+ "regexp"
+ "time"
+
+ "github.com/hashicorp/go-azure-helpers/lang/pointer"
+ "github.com/hashicorp/go-azure-helpers/lang/response"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/location"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
+ computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/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 ComputeFleetResourceModel struct {
+ Name string `tfschema:"name"`
+ ResourceGroupName string `tfschema:"resource_group_name"`
+ Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"`
+ Location string `tfschema:"location"`
+ Plan []PlanModel `tfschema:"plan"`
+ AdditionalLocationProfile []AdditionalLocationProfileModel `tfschema:"additional_location_profile"`
+ AdditionalCapabilitiesUltraSSDEnabled bool `tfschema:"additional_capabilities_ultra_ssd_enabled"`
+ AdditionalCapabilitiesHibernationEnabled bool `tfschema:"additional_capabilities_hibernation_enabled"`
+ VirtualMachineProfile []VirtualMachineProfileModel `tfschema:"virtual_machine_profile"`
+ ComputeApiVersion string `tfschema:"compute_api_version"`
+ PlatformFaultDomainCount int64 `tfschema:"platform_fault_domain_count"`
+ RegularPriorityProfile []RegularPriorityProfileModel `tfschema:"regular_priority_profile"`
+ SpotPriorityProfile []SpotPriorityProfileModel `tfschema:"spot_priority_profile"`
+ UniqueId string `tfschema:"unique_id"`
+ VMAttributes []VMAttributesModel `tfschema:"vm_attributes"`
+ VMSizesProfile []VMSizeProfileModel `tfschema:"vm_sizes_profile"`
+ Tags map[string]string `tfschema:"tags"`
+ Zones []string `tfschema:"zones"`
+}
+
+type AdditionalLocationProfileModel struct {
+ Location string `tfschema:"location"`
+ VirtualMachineProfileOverride []VirtualMachineProfileModel `tfschema:"virtual_machine_profile_override"`
+}
+
+type VirtualMachineProfileModel struct {
+ GalleryApplicationProfile []GalleryApplicationModel `tfschema:"gallery_application"`
+ CapacityReservationGroupId string `tfschema:"capacity_reservation_group_id"`
+ BootDiagnosticEnabled bool `tfschema:"boot_diagnostic_enabled"`
+ BootDiagnosticStorageAccountEndpoint string `tfschema:"boot_diagnostic_storage_account_endpoint"`
+ Extension []ExtensionModel `tfschema:"extension"`
+ ExtensionsTimeBudget string `tfschema:"extensions_time_budget"`
+ ExtensionOperationsEnabled bool `tfschema:"extension_operations_enabled"`
+ LicenseType string `tfschema:"license_type"`
+ NetworkInterface []NetworkInterfaceModel `tfschema:"network_interface"`
+ OsProfile []OSProfileModel `tfschema:"os_profile"`
+ ScheduledEventTerminationTimeout string `tfschema:"scheduled_event_termination_timeout"`
+ ScheduledEventOsImageTimeout string `tfschema:"scheduled_event_os_image_timeout"`
+ EncryptionAtHostEnabled bool `tfschema:"encryption_at_host_enabled"`
+ SecureBootEnabled bool `tfschema:"secure_boot_enabled"`
+ VTpmEnabled bool `tfschema:"vtpm_enabled"`
+ DataDisks []DataDiskModel `tfschema:"data_disk"`
+ OsDisk []OSDiskModel `tfschema:"os_disk"`
+ SourceImageReference []SourceImageReferenceModel `tfschema:"source_image_reference"`
+ SourceImageId string `tfschema:"source_image_id"`
+ UserDataBase64 string `tfschema:"user_data_base64"`
+ NetworkApiVersion string `tfschema:"network_api_version"`
+}
+
+type GalleryApplicationModel struct {
+ ConfigurationBlobUri string `tfschema:"configuration_blob_uri"`
+ AutomaticUpgradeEnabled bool `tfschema:"automatic_upgrade_enabled"`
+ Order int64 `tfschema:"order"`
+ VersionId string `tfschema:"version_id"`
+ Tag string `tfschema:"tag"`
+ TreatFailureAsDeploymentFailureEnabled bool `tfschema:"treat_failure_as_deployment_failure_enabled"`
+}
+
+type ExtensionModel struct {
+ Name string `tfschema:"name"`
+ Publisher string `tfschema:"publisher"`
+ Type string `tfschema:"type"`
+ TypeHandlerVersion string `tfschema:"type_handler_version"`
+ AutoUpgradeMinorVersionEnabled bool `tfschema:"auto_upgrade_minor_version_enabled"`
+ AutomaticUpgradeEnabled bool `tfschema:"automatic_upgrade_enabled"`
+ ForceExtensionExecutionOnChange string `tfschema:"force_extension_execution_on_change"`
+ ProtectedSettingsJson string `tfschema:"protected_settings_json"`
+ ProtectedSettingsFromKeyVault []ProtectedSettingsFromKeyVaultModel `tfschema:"protected_settings_from_key_vault"`
+ ExtensionsToProvisionAfterVmCreation []string `tfschema:"extensions_to_provision_after_vm_creation"`
+ FailureSuppressionEnabled bool `tfschema:"failure_suppression_enabled"`
+ SettingsJson string `tfschema:"settings_json"`
+}
+
+type ProtectedSettingsFromKeyVaultModel struct {
+ SecretUrl string `tfschema:"secret_url"`
+ SourceVaultId string `tfschema:"source_vault_id"`
+}
+
+type NetworkInterfaceModel struct {
+ Name string `tfschema:"name"`
+ AuxiliaryMode string `tfschema:"auxiliary_mode"`
+ AuxiliarySku string `tfschema:"auxiliary_sku"`
+ DeleteOption string `tfschema:"delete_option"`
+ DnsServers []string `tfschema:"dns_servers"`
+ AcceleratedNetworkingEnabled bool `tfschema:"accelerated_networking_enabled"`
+ IPForwardingEnabled bool `tfschema:"ip_forwarding_enabled"`
+ IPConfiguration []IPConfigurationModel `tfschema:"ip_configuration"`
+ NetworkSecurityGroupId string `tfschema:"network_security_group_id"`
+ Primary bool `tfschema:"primary"`
+}
+
+type IPConfigurationModel struct {
+ Name string `tfschema:"name"`
+ ApplicationGatewayBackendAddressPoolIds []string `tfschema:"application_gateway_backend_address_pool_ids"`
+ ApplicationSecurityGroupIds []string `tfschema:"application_security_group_ids"`
+ LoadBalancerBackendAddressPoolIds []string `tfschema:"load_balancer_backend_address_pool_ids"`
+ Primary bool `tfschema:"primary"`
+ Version string `tfschema:"version"`
+ PublicIPAddress []PublicIPAddressModel `tfschema:"public_ip_address"`
+ SubnetId string `tfschema:"subnet_id"`
+}
+
+type PublicIPAddressModel struct {
+ Name string `tfschema:"name"`
+ DeleteOption string `tfschema:"delete_option"`
+ DomainNameLabel string `tfschema:"domain_name_label"`
+ DomainNameLabelScope string `tfschema:"domain_name_label_scope"`
+ IdleTimeoutInMinutes int64 `tfschema:"idle_timeout_in_minutes"`
+ IPTag []IPTagModel `tfschema:"ip_tag"`
+ Version string `tfschema:"version"`
+ PublicIPPrefix string `tfschema:"public_ip_prefix_id"`
+ SkuName string `tfschema:"sku_name"`
+}
+
+type IPTagModel struct {
+ Type string `tfschema:"type"`
+ Tag string `tfschema:"tag"`
+}
+
+type OSProfileModel struct {
+ CustomDataBase64 string `tfschema:"custom_data_base64"`
+ LinuxConfiguration []LinuxConfigurationModel `tfschema:"linux_configuration"`
+ WindowsConfiguration []WindowsConfigurationModel `tfschema:"windows_configuration"`
+}
+
+type LinuxConfigurationModel struct {
+ AdminPassword string `tfschema:"admin_password"`
+ AdminUsername string `tfschema:"admin_username"`
+ ComputerNamePrefix string `tfschema:"computer_name_prefix"`
+ Secret []LinuxSecretModel `tfschema:"secret"`
+ PasswordAuthenticationEnabled bool `tfschema:"password_authentication_enabled"`
+ VMAgentPlatformUpdatesEnabled bool `tfschema:"vm_agent_platform_updates_enabled"`
+ PatchAssessmentMode string `tfschema:"patch_assessment_mode"`
+ PatchMode string `tfschema:"patch_mode"`
+ BypassPlatformSafetyChecksEnabled bool `tfschema:"bypass_platform_safety_checks_enabled"`
+ RebootSetting string `tfschema:"reboot_setting"`
+ ProvisionVMAgentEnabled bool `tfschema:"provision_vm_agent_enabled"`
+ AdminSSHKeys []string `tfschema:"admin_ssh_keys"`
+}
+
+type LinuxSecretModel struct {
+ KeyVaultId string `tfschema:"key_vault_id"`
+ Certificate []LinuxCertificateModel `tfschema:"certificate"`
+}
+
+type WindowsSecretModel struct {
+ KeyVaultId string `tfschema:"key_vault_id"`
+ Certificate []WindowsCertificateModel `tfschema:"certificate"`
+}
+
+type LinuxCertificateModel struct {
+ Url string `tfschema:"url"`
+}
+
+type WindowsCertificateModel struct {
+ Store string `tfschema:"store"`
+ Url string `tfschema:"url"`
+}
+
+type WindowsConfigurationModel struct {
+ AdminPassword string `tfschema:"admin_password"`
+ AdminUsername string `tfschema:"admin_username"`
+ ComputerNamePrefix string `tfschema:"computer_name_prefix"`
+ Secret []WindowsSecretModel `tfschema:"secret"`
+ AdditionalUnattendContent []AdditionalUnattendContentModel `tfschema:"additional_unattend_content"`
+ AutomaticUpdatesEnabled bool `tfschema:"automatic_updates_enabled"`
+ VMAgentPlatformUpdatesEnabled bool `tfschema:"vm_agent_platform_updates_enabled"`
+ PatchAssessmentMode string `tfschema:"patch_assessment_mode"`
+ PatchMode string `tfschema:"patch_mode"`
+ BypassPlatformSafetyChecksEnabled bool `tfschema:"bypass_platform_safety_checks_enabled"`
+ RebootSetting string `tfschema:"reboot_setting"`
+ HotPatchingEnabled bool `tfschema:"hot_patching_enabled"`
+ ProvisionVMAgentEnabled bool `tfschema:"provision_vm_agent_enabled"`
+ TimeZone string `tfschema:"time_zone"`
+ WinRM []WinRMModel `tfschema:"winrm_listener"`
+}
+
+type AdditionalUnattendContentModel struct {
+ Content string `tfschema:"content"`
+ Setting string `tfschema:"setting"`
+}
+
+type WinRMModel struct {
+ CertificateUrl string `tfschema:"certificate_url"`
+ Protocol string `tfschema:"protocol"`
+}
+
+type DataDiskModel struct {
+ Caching string `tfschema:"caching"`
+ CreateOption string `tfschema:"create_option"`
+ DeleteOption string `tfschema:"delete_option"`
+ DiskSizeInGB int64 `tfschema:"disk_size_in_gb"`
+ DiskEncryptionSetId string `tfschema:"disk_encryption_set_id"`
+ StorageAccountType string `tfschema:"storage_account_type"`
+ Lun int64 `tfschema:"lun"`
+ WriteAcceleratorEnabled bool `tfschema:"write_accelerator_enabled"`
+}
+
+type SourceImageReferenceModel struct {
+ Offer string `tfschema:"offer"`
+ Publisher string `tfschema:"publisher"`
+ Sku string `tfschema:"sku"`
+ Version string `tfschema:"version"`
+}
+
+type OSDiskModel struct {
+ Caching string `tfschema:"caching"`
+ DeleteOption string `tfschema:"delete_option"`
+ DiffDiskOption string `tfschema:"diff_disk_option"`
+ DiffDiskPlacement string `tfschema:"diff_disk_placement"`
+ DiskSizeInGB int64 `tfschema:"disk_size_in_gb"`
+ DiskEncryptionSetId string `tfschema:"disk_encryption_set_id"`
+ SecurityEncryptionType string `tfschema:"security_encryption_type"`
+ StorageAccountType string `tfschema:"storage_account_type"`
+ WriteAcceleratorEnabled bool `tfschema:"write_accelerator_enabled"`
+}
+
+type PlanModel struct {
+ Name string `tfschema:"name"`
+ Product string `tfschema:"product"`
+ PromotionCode string `tfschema:"promotion_code"`
+ Publisher string `tfschema:"publisher"`
+}
+
+type RegularPriorityProfileModel struct {
+ AllocationStrategy string `tfschema:"allocation_strategy"`
+ Capacity int64 `tfschema:"capacity"`
+ MinCapacity int64 `tfschema:"min_capacity"`
+}
+
+type SpotPriorityProfileModel struct {
+ AllocationStrategy string `tfschema:"allocation_strategy"`
+ Capacity int64 `tfschema:"capacity"`
+ EvictionPolicy string `tfschema:"eviction_policy"`
+ MaintainEnabled bool `tfschema:"maintain_enabled"`
+ MaxHourlyPricePerVM float64 `tfschema:"max_hourly_price_per_vm"`
+ MinCapacity int64 `tfschema:"min_capacity"`
+}
+
+type VMAttributesModel struct {
+ AcceleratorCount []VMAttributeMinMaxIntegerModel `tfschema:"accelerator_count"`
+ AcceleratorManufacturers []string `tfschema:"accelerator_manufacturers"`
+ AcceleratorSupport string `tfschema:"accelerator_support"`
+ AcceleratorTypes []string `tfschema:"accelerator_types"`
+ ArchitectureTypes []string `tfschema:"architecture_types"`
+ BurstableSupport string `tfschema:"burstable_support"`
+ CpuManufacturers []string `tfschema:"cpu_manufacturers"`
+ DataDiskCount []VMAttributeMinMaxIntegerModel `tfschema:"data_disk_count"`
+ ExcludedVMSizes []string `tfschema:"excluded_vm_sizes"`
+ LocalStorageDiskTypes []string `tfschema:"local_storage_disk_types"`
+ LocalStorageInGib []VMAttributeMinMaxDoubleModel `tfschema:"local_storage_in_gib"`
+ LocalStorageSupport string `tfschema:"local_storage_support"`
+ MemoryInGib []VMAttributeMinMaxDoubleModel `tfschema:"memory_in_gib"`
+ MemoryInGibPerVCPU []VMAttributeMinMaxDoubleModel `tfschema:"memory_in_gib_per_vcpu"`
+ NetworkBandwidthInMbps []VMAttributeMinMaxDoubleModel `tfschema:"network_bandwidth_in_mbps"`
+ NetworkInterfaceCount []VMAttributeMinMaxIntegerModel `tfschema:"network_interface_count"`
+ RdmaNetworkInterfaceCount []VMAttributeMinMaxIntegerModel `tfschema:"rdma_network_interface_count"`
+ RdmaSupport string `tfschema:"rdma_support"`
+ VCPUCount []VMAttributeMinMaxIntegerModel `tfschema:"vcpu_count"`
+ VMCategories []string `tfschema:"vm_categories"`
+}
+
+type VMAttributeMinMaxIntegerModel struct {
+ Max int64 `tfschema:"max"`
+ Min int64 `tfschema:"min"`
+}
+
+type VMAttributeMinMaxDoubleModel struct {
+ Max float64 `tfschema:"max"`
+ Min float64 `tfschema:"min"`
+}
+
+type VMSizeProfileModel struct {
+ Name string `tfschema:"name"`
+ Rank int64 `tfschema:"rank"`
+}
+
+type ComputeFleetResource struct{}
+
+var _ sdk.ResourceWithUpdate = ComputeFleetResource{}
+
+var _ sdk.ResourceWithCustomizeDiff = ComputeFleetResource{}
+
+func (r ComputeFleetResource) ResourceType() string {
+ return "azurerm_compute_fleet"
+}
+
+func (r ComputeFleetResource) ModelObject() interface{} {
+ return &ComputeFleetResourceModel{}
+}
+
+func (r ComputeFleetResource) IDValidationFunc() pluginsdk.SchemaValidateFunc {
+ return fleets.ValidateFleetID
+}
+
+func (r ComputeFleetResource) Arguments() map[string]*pluginsdk.Schema {
+ return map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ForceNew: true,
+ ValidateFunc: validation.StringMatch(
+ regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9.-]{0,62}[a-zA-Z0-9]$"),
+ "The fleet name can only start or end with a number or a letter, and can contain only letters, numbers, periods (.), hyphens (-), up to 64 characters",
+ ),
+ },
+
+ "location": commonschema.Location(),
+
+ "resource_group_name": commonschema.ResourceGroupName(),
+
+ "virtual_machine_profile": virtualMachineProfileSchema(),
+
+ "additional_capabilities_hibernation_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ ForceNew: true,
+ Default: false,
+ },
+
+ "additional_capabilities_ultra_ssd_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ ForceNew: true,
+ Default: false,
+ },
+
+ "additional_location_profile": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ ForceNew: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "location": commonschema.LocationWithoutForceNew(),
+
+ "virtual_machine_profile_override": virtualMachineProfileSchema(),
+ },
+ },
+ },
+
+ "plan": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ ForceNew: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ ForceNew: true,
+ Required: true,
+ },
+
+ "product": {
+ Type: pluginsdk.TypeString,
+ ForceNew: true,
+ Required: true,
+ },
+
+ "publisher": {
+ Type: pluginsdk.TypeString,
+ ForceNew: true,
+ Required: true,
+ },
+
+ "promotion_code": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+ },
+ },
+
+ "platform_fault_domain_count": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ Default: 1,
+ ForceNew: true,
+ },
+
+ "vm_attributes": vmAttributesSchema(),
+
+ "zones": commonschema.ZonesMultipleOptionalForceNew(),
+
+ "compute_api_version": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(),
+
+ "regular_priority_profile": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ AtLeastOneOf: []string{"regular_priority_profile", "spot_priority_profile"},
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "allocation_strategy": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ForceNew: true,
+ Default: string(fleets.RegularPriorityAllocationStrategyLowestPrice),
+ ValidateFunc: validation.StringInSlice([]string{
+ string(fleets.RegularPriorityAllocationStrategyLowestPrice),
+ string(fleets.RegularPriorityAllocationStrategyPrioritized),
+ }, false),
+ },
+
+ "min_capacity": {
+ Type: pluginsdk.TypeInt,
+ ForceNew: true,
+ Optional: true,
+ },
+
+ "capacity": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(0, 10000),
+ },
+ },
+ },
+ },
+
+ "spot_priority_profile": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ AtLeastOneOf: []string{"regular_priority_profile", "spot_priority_profile"},
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "allocation_strategy": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ForceNew: true,
+ Default: string(fleets.SpotAllocationStrategyPriceCapacityOptimized),
+ ValidateFunc: validation.StringInSlice([]string{
+ string(fleets.SpotAllocationStrategyPriceCapacityOptimized),
+ string(fleets.SpotAllocationStrategyLowestPrice),
+ string(fleets.SpotAllocationStrategyCapacityOptimized),
+ }, false),
+ },
+
+ "eviction_policy": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ForceNew: true,
+ Default: string(fleets.EvictionPolicyDelete),
+ ValidateFunc: validation.StringInSlice([]string{
+ string(fleets.EvictionPolicyDelete),
+ string(fleets.EvictionPolicyDeallocate),
+ }, false),
+ },
+
+ "maintain_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ ForceNew: true,
+ Default: true,
+ },
+
+ "max_hourly_price_per_vm": {
+ Type: pluginsdk.TypeFloat,
+ Optional: true,
+ ForceNew: true,
+ Default: -1,
+ ValidateFunc: computeValidate.SpotMaxPrice,
+ },
+
+ "min_capacity": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ForceNew: true,
+ ValidateFunc: validation.IntAtLeast(0),
+ },
+
+ "capacity": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(0, 10000),
+ },
+ },
+ },
+ },
+
+ "tags": commonschema.Tags(),
+
+ "vm_sizes_profile": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "rank": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(0, 65535),
+ },
+ },
+ },
+ ConflictsWith: []string{"vm_attributes.0.excluded_vm_sizes"},
+ AtLeastOneOf: []string{"vm_sizes_profile", "vm_attributes"},
+ },
+ }
+}
+
+func vmAttributesSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ ForceNew: true,
+ MaxItems: 1,
+ AtLeastOneOf: []string{"vm_sizes_profile", "vm_attributes"},
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "memory_in_gib": {
+ Type: pluginsdk.TypeList,
+ Required: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinFloatSchema("memory_in_gib"),
+ },
+ },
+
+ "vcpu_count": {
+ Type: pluginsdk.TypeList,
+ Required: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinIntegerSchema("vcpu_count"),
+ },
+ },
+
+ "accelerator_count": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinIntegerSchema("accelerator_count"),
+ },
+ },
+
+ "accelerator_manufacturers": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForAcceleratorManufacturer(), false),
+ },
+ },
+
+ "accelerator_support": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.VMAttributeSupportExcluded),
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForVMAttributeSupport(), false),
+ },
+
+ "accelerator_types": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForAcceleratorType(), false),
+ },
+ },
+
+ "architecture_types": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForArchitectureType(), false),
+ },
+ },
+
+ "burstable_support": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.VMAttributeSupportExcluded),
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForVMAttributeSupport(), false),
+ },
+
+ "cpu_manufacturers": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForCPUManufacturer(), false),
+ },
+ },
+
+ "data_disk_count": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinIntegerSchema("data_disk_count"),
+ },
+ },
+
+ "excluded_vm_sizes": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ ConflictsWith: []string{"vm_sizes_profile"},
+ },
+
+ "local_storage_disk_types": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForLocalStorageDiskType(), false),
+ },
+ },
+
+ "local_storage_in_gib": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinFloatSchema("local_storage_in_gib"),
+ },
+ },
+
+ "local_storage_support": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.VMAttributeSupportIncluded),
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForVMAttributeSupport(), false),
+ },
+
+ "memory_in_gib_per_vcpu": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinFloatSchema("memory_in_gib_per_vcpu"),
+ },
+ },
+
+ "network_bandwidth_in_mbps": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinFloatSchema("network_bandwidth_in_mbps"),
+ },
+ },
+
+ "network_interface_count": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinIntegerSchema("network_interface_count"),
+ },
+ },
+
+ "rdma_network_interface_count": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: vmAttributesMaxMinIntegerSchema("rdma_network_interface_count"),
+ },
+ },
+
+ "rdma_support": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.VMAttributeSupportExcluded),
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForVMAttributeSupport(), false),
+ },
+
+ "vm_categories": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringInSlice(
+ fleets.PossibleValuesForVMCategory(), false),
+ },
+ },
+ },
+ },
+ }
+}
+
+func vmAttributesMaxMinIntegerSchema(parent string) map[string]*pluginsdk.Schema {
+ return map[string]*pluginsdk.Schema{
+ "max": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntAtLeast(0),
+ AtLeastOneOf: []string{"vm_attributes.0." + parent + ".0.max", "vm_attributes.0." + parent + ".0.min"},
+ },
+
+ "min": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntAtLeast(0),
+ AtLeastOneOf: []string{"vm_attributes.0." + parent + ".0.max", "vm_attributes.0." + parent + ".0.min"},
+ },
+ }
+}
+
+func vmAttributesMaxMinFloatSchema(parent string) map[string]*pluginsdk.Schema {
+ return map[string]*pluginsdk.Schema{
+ "max": {
+ Type: pluginsdk.TypeFloat,
+ Optional: true,
+ ValidateFunc: validation.FloatAtLeast(0.0),
+ AtLeastOneOf: []string{"vm_attributes.0." + parent + ".0.max", "vm_attributes.0." + parent + ".0.min"},
+ },
+
+ "min": {
+ Type: pluginsdk.TypeFloat,
+ Optional: true,
+ ValidateFunc: validation.FloatAtLeast(0.0),
+ AtLeastOneOf: []string{"vm_attributes.0." + parent + ".0.max", "vm_attributes.0." + parent + ".0.min"},
+ },
+ }
+}
+
+func (r ComputeFleetResource) Attributes() map[string]*pluginsdk.Schema {
+ return map[string]*pluginsdk.Schema{
+ "unique_id": {
+ Type: pluginsdk.TypeString,
+ Computed: true,
+ },
+ }
+}
+
+func (r ComputeFleetResource) Create() sdk.ResourceFunc {
+ return sdk.ResourceFunc{
+ Timeout: 30 * time.Minute,
+ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
+ client := metadata.Client.ComputeFleet.ComputeFleetClient
+ subscriptionId := metadata.Client.Account.SubscriptionId
+
+ var model ComputeFleetResourceModel
+ if err := metadata.Decode(&model); err != nil {
+ return fmt.Errorf("decoding: %+v", err)
+ }
+
+ id := fleets.NewFleetID(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)
+ }
+
+ properties := fleets.Fleet{
+ Location: location.Normalize(model.Location),
+ Plan: expandPlanModel(model.Plan),
+ Properties: &fleets.FleetProperties{
+ RegularPriorityProfile: expandRegularPriorityProfileModel(model.RegularPriorityProfile),
+ SpotPriorityProfile: expandSpotPriorityProfileModel(model.SpotPriorityProfile),
+ VMAttributes: expandVMAttributesModel(model.VMAttributes),
+ VMSizesProfile: pointer.From(expandVMSizeProfileModel(model.VMSizesProfile)),
+ },
+ }
+
+ if model.Tags != nil {
+ properties.Tags = pointer.To(model.Tags)
+ }
+
+ if model.Zones != nil {
+ properties.Zones = pointer.To(model.Zones)
+ }
+
+ expandedIdentity, err := identity.ExpandLegacySystemAndUserAssignedMapFromModel(model.Identity)
+ if err != nil {
+ return fmt.Errorf("expanding `identity`: %+v", err)
+ }
+ properties.Identity = expandedIdentity
+
+ additionalLocationsProfileValue, err := expandAdditionalLocationProfileModel(model.AdditionalLocationProfile, metadata.ResourceData)
+ if err != nil {
+ return err
+ }
+ properties.Properties.AdditionalLocationsProfile = additionalLocationsProfileValue
+
+ computeProfile := fleets.ComputeProfile{
+ AdditionalVirtualMachineCapabilities: &fleets.AdditionalCapabilities{
+ HibernationEnabled: pointer.To(model.AdditionalCapabilitiesHibernationEnabled),
+ UltraSSDEnabled: pointer.To(model.AdditionalCapabilitiesUltraSSDEnabled),
+ },
+ PlatformFaultDomainCount: pointer.To(model.PlatformFaultDomainCount),
+ }
+ if model.ComputeApiVersion != "" {
+ computeProfile.ComputeApiVersion = pointer.To(model.ComputeApiVersion)
+ }
+
+ baseVirtualMachineProfileValue, err := expandVirtualMachineProfileModel(model.VirtualMachineProfile, metadata.ResourceData, false, len(model.VMAttributes) > 0)
+ if err != nil {
+ return err
+ }
+ computeProfile.BaseVirtualMachineProfile = pointer.From(baseVirtualMachineProfileValue)
+ properties.Properties.ComputeProfile = computeProfile
+
+ if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil {
+ return fmt.Errorf("creating %s: %+v", id, err)
+ }
+
+ metadata.SetID(id)
+
+ return nil
+ },
+ }
+}
+
+func (r ComputeFleetResource) Update() sdk.ResourceFunc {
+ return sdk.ResourceFunc{
+ Timeout: 30 * time.Minute,
+ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
+ client := metadata.Client.ComputeFleet.ComputeFleetClient
+
+ id, err := fleets.ParseFleetID(metadata.ResourceData.Id())
+ if err != nil {
+ return err
+ }
+
+ var model ComputeFleetResourceModel
+ if err := metadata.Decode(&model); err != nil {
+ return fmt.Errorf("decoding: %+v", err)
+ }
+
+ existing, err := client.Get(ctx, *id)
+ if err != nil {
+ return fmt.Errorf("retrieving %s: %+v", *id, err)
+ }
+
+ if existing.Model == nil {
+ return fmt.Errorf("retrieving %s: `model` was nil", *id)
+ }
+ if existing.Model.Properties == nil {
+ return fmt.Errorf("retrieving %s: `properties` was nil", *id)
+ }
+
+ properties := existing.Model
+
+ // API requires `osProfile.adminPassword` when updating resource but the GET API does not return the sensitive data `osProfile.adminPassword`
+ if props := properties.Properties; props != nil {
+ if len(model.VirtualMachineProfile[0].OsProfile[0].LinuxConfiguration) > 0 {
+ if v := props.ComputeProfile.BaseVirtualMachineProfile.OsProfile; v != nil {
+ v.AdminPassword = pointer.To(model.VirtualMachineProfile[0].OsProfile[0].LinuxConfiguration[0].AdminPassword)
+ }
+ }
+ if len(model.VirtualMachineProfile[0].OsProfile[0].WindowsConfiguration) > 0 {
+ if v := props.ComputeProfile.BaseVirtualMachineProfile.OsProfile; v != nil {
+ v.AdminPassword = pointer.To(model.VirtualMachineProfile[0].OsProfile[0].WindowsConfiguration[0].AdminPassword)
+ }
+ }
+
+ if a := model.AdditionalLocationProfile; len(a) > 0 && len(a[0].VirtualMachineProfileOverride) > 0 {
+ if os := a[0].VirtualMachineProfileOverride[0].OsProfile; len(os) > 0 && len(os[0].WindowsConfiguration) > 0 {
+ if v := props.AdditionalLocationsProfile; v != nil && len(v.LocationProfiles) > 0 {
+ if vmss := v.LocationProfiles[0].VirtualMachineProfileOverride; vmss != nil && vmss.OsProfile != nil {
+ vmss.OsProfile.AdminPassword = pointer.To(os[0].WindowsConfiguration[0].AdminPassword)
+ }
+ }
+ }
+ if os := a[0].VirtualMachineProfileOverride[0].OsProfile; len(os) > 0 && len(os[0].LinuxConfiguration) > 0 {
+ if v := props.AdditionalLocationsProfile; v != nil && len(v.LocationProfiles) > 0 {
+ if vmss := v.LocationProfiles[0].VirtualMachineProfileOverride; vmss != nil && vmss.OsProfile != nil {
+ vmss.OsProfile.AdminPassword = pointer.To(os[0].LinuxConfiguration[0].AdminPassword)
+ }
+ }
+ }
+ }
+ }
+
+ if metadata.ResourceData.HasChange("identity") {
+ identityValue, err := identity.ExpandLegacySystemAndUserAssignedMapFromModel(model.Identity)
+ if err != nil {
+ return fmt.Errorf("expanding `identity`: %+v", err)
+ }
+ properties.Identity = identityValue
+ }
+
+ if metadata.ResourceData.HasChange("plan") {
+ properties.Plan = expandPlanModel(model.Plan)
+ }
+
+ if metadata.ResourceData.HasChange("additional_location_profile") {
+ additionalLocationsProfileValue, err := expandAdditionalLocationProfileModel(model.AdditionalLocationProfile, metadata.ResourceData)
+ if err != nil {
+ return err
+ }
+ properties.Properties.AdditionalLocationsProfile = additionalLocationsProfileValue
+ }
+
+ if metadata.ResourceData.HasChange("virtual_machine_profile") {
+ baseVirtualMachineProfileValue, err := expandVirtualMachineProfileModel(model.VirtualMachineProfile, metadata.ResourceData, false, len(model.VMAttributes) > 0)
+ if err != nil {
+ return err
+ }
+ properties.Properties.ComputeProfile.BaseVirtualMachineProfile = pointer.From(baseVirtualMachineProfileValue)
+ }
+
+ if metadata.ResourceData.HasChange("compute_api_version") {
+ properties.Properties.ComputeProfile.ComputeApiVersion = pointer.To(model.ComputeApiVersion)
+ }
+
+ if metadata.ResourceData.HasChange("regular_priority_profile") {
+ properties.Properties.RegularPriorityProfile = expandRegularPriorityProfileModel(model.RegularPriorityProfile)
+ }
+
+ if metadata.ResourceData.HasChange("spot_priority_profile") {
+ properties.Properties.SpotPriorityProfile = expandSpotPriorityProfileModel(model.SpotPriorityProfile)
+ }
+
+ if metadata.ResourceData.HasChange("vm_attributes") {
+ properties.Properties.VMAttributes = expandVMAttributesModel(model.VMAttributes)
+ }
+
+ if metadata.ResourceData.HasChange("vm_sizes_profile") {
+ properties.Properties.VMSizesProfile = pointer.From(expandVMSizeProfileModel(model.VMSizesProfile))
+ }
+
+ if metadata.ResourceData.HasChange("tags") {
+ properties.Tags = &model.Tags
+ }
+
+ if err := client.CreateOrUpdateThenPoll(ctx, *id, *properties); err != nil {
+ return fmt.Errorf("updating %s: %+v", *id, err)
+ }
+
+ return nil
+ },
+ }
+}
+
+func (r ComputeFleetResource) Read() sdk.ResourceFunc {
+ return sdk.ResourceFunc{
+ Timeout: 5 * time.Minute,
+ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
+ client := metadata.Client.ComputeFleet.ComputeFleetClient
+
+ id, err := fleets.ParseFleetID(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 := ComputeFleetResourceModel{
+ Name: id.FleetName,
+ ResourceGroupName: id.ResourceGroupName,
+ }
+
+ if model := resp.Model; model != nil {
+ state.Location = location.Normalize(model.Location)
+
+ if model.Identity != nil {
+ v, err := identity.FlattenSystemAndUserAssignedMapToModel(pointer.To(identity.SystemAndUserAssignedMap(*model.Identity)))
+ if err != nil {
+ return err
+ }
+ state.Identity = pointer.From(v)
+ }
+
+ state.Plan = flattenPlanModel(model.Plan)
+
+ if props := model.Properties; props != nil {
+ additionalLocationsProfileValue, err := flattenAdditionalLocationProfileModel(props.AdditionalLocationsProfile, metadata)
+ if err != nil {
+ return err
+ }
+ state.AdditionalLocationProfile = additionalLocationsProfileValue
+
+ if v := props.ComputeProfile.AdditionalVirtualMachineCapabilities; v != nil {
+ state.AdditionalCapabilitiesHibernationEnabled = pointer.From(v.HibernationEnabled)
+ state.AdditionalCapabilitiesUltraSSDEnabled = pointer.From(v.UltraSSDEnabled)
+ }
+
+ baseVirtualMachineProfileValue, err := flattenVirtualMachineProfileModel(&props.ComputeProfile.BaseVirtualMachineProfile, metadata, false)
+ if err != nil {
+ return err
+ }
+ state.VirtualMachineProfile = baseVirtualMachineProfileValue
+
+ state.ComputeApiVersion = pointer.From(props.ComputeProfile.ComputeApiVersion)
+ state.PlatformFaultDomainCount = pointer.From(props.ComputeProfile.PlatformFaultDomainCount)
+
+ state.RegularPriorityProfile = flattenRegularPriorityProfileModel(props.RegularPriorityProfile)
+ state.SpotPriorityProfile = flattenSpotPriorityProfileModel(props.SpotPriorityProfile)
+ state.UniqueId = pointer.From(props.UniqueId)
+ state.VMAttributes = flattenVMAttributesModel(props.VMAttributes)
+ state.VMSizesProfile = flattenVMSizeProfileModel(&props.VMSizesProfile)
+ }
+ state.Tags = pointer.From(model.Tags)
+ state.Zones = pointer.From(model.Zones)
+ }
+
+ return metadata.Encode(&state)
+ },
+ }
+}
+
+func (r ComputeFleetResource) Delete() sdk.ResourceFunc {
+ return sdk.ResourceFunc{
+ Timeout: 30 * time.Minute,
+ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
+ client := metadata.Client.ComputeFleet.ComputeFleetClient
+
+ id, err := fleets.ParseFleetID(metadata.ResourceData.Id())
+ if err != nil {
+ return err
+ }
+
+ if err := client.DeleteThenPoll(ctx, *id); err != nil {
+ return fmt.Errorf("deleting %s: %+v", id, err)
+ }
+
+ return nil
+ },
+ }
+}
+func customizeForVmAttributes(state ComputeFleetResourceModel, d sdk.ResourceMetaData) error {
+ // Once the properties of vm_attributes are added, they can not be removed
+ old, new := d.ResourceDiff.GetChange("vm_attributes.0.accelerator_count")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.accelerator_count"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.accelerator_manufacturers")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.accelerator_manufacturers"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.accelerator_support")
+ if old.(string) != "" && new.(string) == "" {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.accelerator_support"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.accelerator_types")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.accelerator_types"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.architecture_types")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.architecture_types"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.burstable_support")
+ if old.(string) != "" && new.(string) == "" {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.burstable_support"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.cpu_manufacturers")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.cpu_manufacturers"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.data_disk_count")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.data_disk_count"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.excluded_vm_sizes")
+ if len(old.(*pluginsdk.Set).List()) > 0 && len(new.(*pluginsdk.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.excluded_vm_sizes"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.local_storage_disk_types")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.local_storage_disk_types"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.local_storage_in_gib")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.local_storage_in_gib"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.local_storage_support")
+ if old.(string) != "" && new.(string) == "" {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.local_storage_support"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.memory_in_gib_per_vcpu")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.memory_in_gib_per_vcpu"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.network_bandwidth_in_mbps")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.network_bandwidth_in_mbps"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.network_interface_count")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.network_interface_count"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.rdma_network_interface_count")
+ if len(old.([]interface{})) > 0 && len(new.([]interface{})) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.rdma_network_interface_count"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.rdma_support")
+ if old.(string) != "" && new.(string) == "" {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.rdma_support"); err != nil {
+ return err
+ }
+ }
+ old, new = d.ResourceDiff.GetChange("vm_attributes.0.vm_categories")
+ if len(old.(*schema.Set).List()) > 0 && len(new.(*schema.Set).List()) == 0 {
+ if err := d.ResourceDiff.ForceNew("vm_attributes.0.vm_categories"); err != nil {
+ return err
+ }
+ }
+
+ if v := state.VMAttributes; len(v) > 0 {
+ if v[0].AcceleratorSupport == string(fleets.VMAttributeSupportExcluded) {
+ if len(v[0].AcceleratorManufacturers) > 0 {
+ return fmt.Errorf("`accelerator_manufacturers` cannot be used when `accelerator_support` is specified as `Excluded`")
+ }
+ if len(v[0].AcceleratorTypes) > 0 {
+ return fmt.Errorf("`accelerator_types` cannot be used when `accelerator_support` is specified as `Excluded`")
+ }
+ if len(v[0].AcceleratorCount) > 0 {
+ return fmt.Errorf("`accelerator_count` cannot be used when `accelerator_support` is specified as `Excluded`")
+ }
+ if len(v[0].VMCategories) > 0 && utils.SliceContainsValue(v[0].VMCategories, string(fleets.VMCategoryGpuAccelerated)) {
+ return fmt.Errorf("`GpuAccelerated` cannot be used when `accelerator_support` is specified as `Excluded`")
+ }
+ }
+
+ if v[0].LocalStorageSupport == string(fleets.VMAttributeSupportExcluded) {
+ if len(v[0].LocalStorageInGib) > 0 {
+ return fmt.Errorf("`local_storage_in_gib` cannot be used when `local_storage_support` is specified as `Excluded`")
+ }
+ if len(v[0].LocalStorageDiskTypes) > 0 {
+ return fmt.Errorf("`local_storage_disk_types` cannot be used when `local_storage_support` is specified as `Excluded`")
+ }
+ }
+
+ if v[0].RdmaSupport == string(fleets.VMAttributeSupportExcluded) {
+ if len(v[0].RdmaNetworkInterfaceCount) > 0 {
+ return fmt.Errorf("`rdma_network_interface_count` cannot be used when `rdma_support` is specified as `Excluded`")
+ }
+ }
+ }
+
+ return nil
+}
+
+func (r ComputeFleetResource) CustomizeDiff() sdk.ResourceFunc {
+ return sdk.ResourceFunc{
+ Timeout: 5 * time.Minute,
+ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
+ var state ComputeFleetResourceModel
+ if err := metadata.DecodeDiff(&state); err != nil {
+ return fmt.Errorf("DecodeDiff: %+v", err)
+ }
+
+ err := customizeForVmAttributes(state, metadata)
+ if err != nil {
+ return err
+ }
+
+ if v := state.Identity; len(v) > 0 {
+ // whilst the Swagger defines multiple at this time only UAI is supported
+ if v[0].Type != identity.TypeUserAssigned {
+ return fmt.Errorf("the type `%s` of `identity` is not supported currently", v[0].Type)
+ }
+ }
+
+ if len(state.SpotPriorityProfile) > 0 && len(state.RegularPriorityProfile) > 0 {
+ if state.SpotPriorityProfile[0].Capacity+state.RegularPriorityProfile[0].Capacity > 10000 {
+ return fmt.Errorf("the sum of `spot_priority_profile.0.capacity` and `regular_priority_profile.0.capacity` must be between `0` and `10000`, inclusive")
+ }
+ }
+
+ if len(state.SpotPriorityProfile) > 0 {
+ if state.SpotPriorityProfile[0].MaintainEnabled {
+ if state.SpotPriorityProfile[0].MinCapacity > 0 {
+ return fmt.Errorf("`spot_priority_profile.0.min_capacity` is unable to be specified if `spot_priority_profile.0.maintain_enabled` is enabled")
+ }
+
+ if len(state.VMSizesProfile) < 3 {
+ return fmt.Errorf("`vm_sizes_profile` must be at least 3 Vm sizes if `spot_priority_profile.0.maintain_enabled` is enabled")
+ }
+
+ if len(state.Zones) == 0 {
+ return fmt.Errorf("enabling `spot_priority_profile.0.maintain_enabled` requires all qualified availability zones in the region to be supported")
+ }
+ } else if len(state.RegularPriorityProfile) == 0 {
+ // For Spot VMs, you may delete or replace existing VM sizes in your Compute Fleet configuration, if the capacity preference is set to Maintain capacity.
+ // In all other scenarios requiring a modification to the running Compute Fleet, you may have to delete the existing Compute Fleet and create a new one.
+ if metadata.ResourceDiff.HasChange("vm_sizes_profile") {
+ if err := metadata.ResourceDiff.ForceNew("vm_sizes_profile"); err != nil {
+ return err
+ }
+ }
+ }
+
+ if state.SpotPriorityProfile[0].MinCapacity > state.SpotPriorityProfile[0].Capacity {
+ return fmt.Errorf("`spot_priority_profile.0.min_capacity` must be between `0` and `spot_priority_profile.0.capacity`, inclusive")
+ }
+ }
+
+ if len(state.RegularPriorityProfile) > 0 {
+ if state.RegularPriorityProfile[0].MinCapacity > state.RegularPriorityProfile[0].Capacity {
+ return fmt.Errorf("`RegularPriorityProfile.0.min_capacity` must be between `0` and `RegularPriorityProfile.0.capacity`, inclusive")
+ }
+ }
+
+ if len(state.VMSizesProfile) > 15 {
+ return fmt.Errorf("the VM sizes count of `vm_sizes_profile` cannot be greater than `15`")
+ }
+
+ if v := state.VirtualMachineProfile[0].DataDisks; len(v) > 0 {
+ storageAccountType := v[0].StorageAccountType
+ ultraSSDEnabled := state.AdditionalCapabilitiesUltraSSDEnabled
+
+ if !ultraSSDEnabled && storageAccountType == string(fleets.StorageAccountTypesUltraSSDLRS) {
+ return fmt.Errorf("`UltraSSD_LRS` storage account type can be used only when `additional_capabilities_ultra_ssd_enabled` is enalbed")
+ }
+
+ if v[0].CreateOption == string(fleets.DiskCreateOptionTypesEmpty) {
+ if v[0].DiskSizeInGB == 0 {
+ return fmt.Errorf("`disk_size_in_gb` is required when`create_option` is `Empty`")
+ }
+
+ lunExist := metadata.ResourceDiff.GetRawConfig().AsValueMap()["virtual_machine_profile"].AsValueSlice()[0].AsValueMap()["data_disk"].AsValueSlice()[0].AsValueMap()["lun"]
+ if lunExist.IsNull() {
+ return fmt.Errorf("`lun` is required when`create_option` is `Empty`")
+ }
+ }
+ }
+
+ vmProfile := state.VirtualMachineProfile[0]
+ osProfile := vmProfile.OsProfile[0]
+ if len(osProfile.WindowsConfiguration) > 0 && len(osProfile.LinuxConfiguration) > 0 ||
+ len(osProfile.WindowsConfiguration) == 0 && len(osProfile.LinuxConfiguration) == 0 {
+ return fmt.Errorf("only one of `linux_configuration` and `windows_configuration` in `virtual_machine_profile` must be specified")
+ }
+ if vmProfile.SourceImageId != "" && len(vmProfile.SourceImageReference) > 0 {
+ return fmt.Errorf("only one of `source_image_id` and `source_image_reference` in `virtual_machine_profile` must be specified")
+ }
+
+ if v := state.AdditionalLocationProfile; len(v) > 0 && len(v[0].VirtualMachineProfileOverride) > 0 {
+ osProfile = state.AdditionalLocationProfile[0].VirtualMachineProfileOverride[0].OsProfile[0]
+ if len(osProfile.WindowsConfiguration) > 0 && len(osProfile.LinuxConfiguration) > 0 ||
+ len(osProfile.WindowsConfiguration) == 0 && len(osProfile.LinuxConfiguration) == 0 {
+ return fmt.Errorf("only one of `linux_configuration` and `windows_configuration` in `virtual_machine_profile_override` must be specified")
+ }
+
+ if state.VirtualMachineProfile[0].CapacityReservationGroupId != "" && state.AdditionalLocationProfile[0].VirtualMachineProfileOverride[0].CapacityReservationGroupId == "" {
+ return fmt.Errorf("`virtual_machine_profile_override.0.capacity_reservation_group_id` is required when `virtual_machine_profile.0.capacity_reservation_group_id` is specified")
+ }
+
+ dataDisks := state.AdditionalLocationProfile[0].VirtualMachineProfileOverride[0].DataDisks
+ if len(dataDisks) > 0 {
+ if dataDisks[0].CreateOption == string(fleets.DiskCreateOptionTypesEmpty) {
+ if dataDisks[0].DiskSizeInGB == 0 {
+ return fmt.Errorf("`disk_size_in_gb` is required when`create_option` is `Empty`")
+ }
+ lunExist := metadata.ResourceDiff.GetRawConfig().AsValueMap()["additional_location_profile"].AsValueSlice()[0].AsValueMap()["virtual_machine_profile_override"].AsValueSlice()[0].AsValueMap()["data_disk"].AsValueSlice()[0].AsValueMap()["lun"]
+ if lunExist.IsNull() {
+ return fmt.Errorf("`lun` is required when`create_option` is `Empty`")
+ }
+ }
+ }
+ }
+
+ err = validateSecuritySetting(state.VirtualMachineProfile)
+ if err != nil {
+ return err
+ }
+
+ err = validateWindowsSetting(state.VirtualMachineProfile, metadata.ResourceDiff, false)
+ if err != nil {
+ return err
+ }
+
+ err = validateLinuxSetting(state.VirtualMachineProfile, metadata.ResourceDiff, false)
+ if err != nil {
+ return err
+ }
+
+ if len(state.AdditionalLocationProfile) > 0 {
+ err = validateWindowsSetting(state.AdditionalLocationProfile[0].VirtualMachineProfileOverride, metadata.ResourceDiff, true)
+ if err != nil {
+ return err
+ }
+
+ err = validateLinuxSetting(state.AdditionalLocationProfile[0].VirtualMachineProfileOverride, metadata.ResourceDiff, true)
+ if err != nil {
+ return err
+ }
+ }
+ for _, v := range state.VirtualMachineProfile[0].Extension {
+ if v.ProtectedSettingsJson != "" {
+ if len(v.ProtectedSettingsFromKeyVault) > 0 {
+ return fmt.Errorf("`protected_settings_from_key_vault` cannot be used with `protected_settings_json`")
+ }
+ }
+ }
+
+ if len(state.Zones) > 0 && state.PlatformFaultDomainCount > 1 {
+ return fmt.Errorf("specifying `zones` is not allowed when `platform_fault_domain_count` higher than 1")
+ }
+
+ return nil
+ },
+ }
+}
+
+func expandPlanModel(inputList []PlanModel) *fleets.Plan {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ output := fleets.Plan{
+ Name: input.Name,
+ Product: input.Product,
+ Publisher: input.Publisher,
+ }
+
+ if input.PromotionCode != "" {
+ output.PromotionCode = pointer.To(input.PromotionCode)
+ }
+
+ return &output
+}
+
+func expandRegularPriorityProfileModel(inputList []RegularPriorityProfileModel) *fleets.RegularPriorityProfile {
+ if len(inputList) == 0 {
+ return nil
+ }
+ input := &inputList[0]
+ output := fleets.RegularPriorityProfile{
+ AllocationStrategy: pointer.To(fleets.RegularPriorityAllocationStrategy(input.AllocationStrategy)),
+ Capacity: pointer.To(input.Capacity),
+ MinCapacity: pointer.To(input.MinCapacity),
+ }
+
+ return &output
+}
+
+func expandSpotPriorityProfileModel(inputList []SpotPriorityProfileModel) *fleets.SpotPriorityProfile {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ output := fleets.SpotPriorityProfile{
+ AllocationStrategy: pointer.To(fleets.SpotAllocationStrategy(input.AllocationStrategy)),
+ Capacity: pointer.To(input.Capacity),
+ EvictionPolicy: pointer.To(fleets.EvictionPolicy(input.EvictionPolicy)),
+ Maintain: pointer.To(input.MaintainEnabled),
+ MinCapacity: pointer.To(input.MinCapacity),
+ }
+
+ if input.MaxHourlyPricePerVM > 0 {
+ output.MaxPricePerVM = pointer.To(input.MaxHourlyPricePerVM)
+ }
+ return &output
+}
+
+func expandVMAttributesModel(inputList []VMAttributesModel) *fleets.VMAttributes {
+ if len(inputList) == 0 {
+ return nil
+ }
+ input := &inputList[0]
+ output := fleets.VMAttributes{
+ AcceleratorCount: expandVMAttributeMinMaxIntegerModel(input.AcceleratorCount),
+ AcceleratorManufacturers: expandAcceleratorManufacturers(input.AcceleratorManufacturers),
+ AcceleratorSupport: pointer.To(fleets.VMAttributeSupport(input.AcceleratorSupport)),
+ AcceleratorTypes: expandAcceleratorTypes(input.AcceleratorTypes),
+ ArchitectureTypes: expandArchitectureTypes(input.ArchitectureTypes),
+ BurstableSupport: pointer.To(fleets.VMAttributeSupport(input.BurstableSupport)),
+ CpuManufacturers: expandCPUManufacturers(input.CpuManufacturers),
+ DataDiskCount: expandVMAttributeMinMaxIntegerModel(input.DataDiskCount),
+ LocalStorageDiskTypes: expandLocalStorageDiskTypes(input.LocalStorageDiskTypes),
+ LocalStorageInGiB: expandVMAttributeMinMaxDoubleModel(input.LocalStorageInGib),
+ LocalStorageSupport: pointer.To(fleets.VMAttributeSupport(input.LocalStorageSupport)),
+ MemoryInGiBPerVCPU: expandVMAttributeMinMaxDoubleModel(input.MemoryInGibPerVCPU),
+ NetworkBandwidthInMbps: expandVMAttributeMinMaxDoubleModel(input.NetworkBandwidthInMbps),
+ NetworkInterfaceCount: expandVMAttributeMinMaxIntegerModel(input.NetworkInterfaceCount),
+ RdmaNetworkInterfaceCount: expandVMAttributeMinMaxIntegerModel(input.RdmaNetworkInterfaceCount),
+ RdmaSupport: pointer.To(fleets.VMAttributeSupport(input.RdmaSupport)),
+ VMCategories: expandVMCategories(input.VMCategories),
+ }
+
+ if len(input.ExcludedVMSizes) > 0 {
+ output.ExcludedVMSizes = pointer.To(input.ExcludedVMSizes)
+ }
+ output.MemoryInGiB = pointer.From(expandVMAttributeMinMaxDoubleModel(input.MemoryInGib))
+
+ output.VCPUCount = pointer.From(expandVMAttributeMinMaxIntegerModel(input.VCPUCount))
+
+ return &output
+}
+
+func expandVMAttributeMinMaxIntegerModel(inputList []VMAttributeMinMaxIntegerModel) *fleets.VMAttributeMinMaxInteger {
+ if len(inputList) == 0 {
+ return nil
+ }
+ input := &inputList[0]
+ output := fleets.VMAttributeMinMaxInteger{
+ Max: pointer.To(input.Max),
+ Min: pointer.To(input.Min),
+ }
+
+ return &output
+}
+
+func expandVMAttributeMinMaxDoubleModel(inputList []VMAttributeMinMaxDoubleModel) *fleets.VMAttributeMinMaxDouble {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ output := fleets.VMAttributeMinMaxDouble{
+ Max: &input.Max,
+ Min: &input.Min,
+ }
+
+ return &output
+}
+
+func expandVMCategories(inputList []string) *[]fleets.VMCategory {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.VMCategory, 0)
+ for _, v := range inputList {
+ if v != "" {
+ outputList = append(outputList, fleets.VMCategory(v))
+ }
+ }
+ return &outputList
+}
+
+func expandLocalStorageDiskTypes(inputList []string) *[]fleets.LocalStorageDiskType {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.LocalStorageDiskType, 0)
+ for _, v := range inputList {
+ if v != "" {
+ outputList = append(outputList, fleets.LocalStorageDiskType(v))
+ }
+ }
+ return &outputList
+}
+
+func expandAcceleratorManufacturers(inputList []string) *[]fleets.AcceleratorManufacturer {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ result := make([]fleets.AcceleratorManufacturer, 0)
+
+ for _, v := range inputList {
+ if v != "" {
+ result = append(result, fleets.AcceleratorManufacturer(v))
+ }
+ }
+
+ return &result
+}
+
+func expandAcceleratorTypes(inputList []string) *[]fleets.AcceleratorType {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.AcceleratorType, 0)
+ for _, v := range inputList {
+ if v != "" {
+ outputList = append(outputList, fleets.AcceleratorType(v))
+ }
+ }
+ return &outputList
+}
+
+func expandArchitectureTypes(inputList []string) *[]fleets.ArchitectureType {
+ if len(inputList) == 0 {
+ return nil
+ }
+ outputList := make([]fleets.ArchitectureType, 0)
+ for _, v := range inputList {
+ if v != "" {
+ outputList = append(outputList, fleets.ArchitectureType(v))
+ }
+ }
+ return &outputList
+}
+
+func expandCPUManufacturers(inputList []string) *[]fleets.CPUManufacturer {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.CPUManufacturer, 0)
+ for _, v := range inputList {
+ if v != "" {
+ outputList = append(outputList, fleets.CPUManufacturer(v))
+ }
+ }
+ return &outputList
+}
+
+func expandVMSizeProfileModel(inputList []VMSizeProfileModel) *[]fleets.VMSizeProfile {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.VMSizeProfile, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.VMSizeProfile{
+ Name: input.Name,
+ }
+ if input.Rank > 0 {
+ output.Rank = pointer.To(input.Rank)
+ }
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandAdditionalLocationProfileModel(inputList []AdditionalLocationProfileModel, d *schema.ResourceData) (*fleets.AdditionalLocationsProfile, error) {
+ if len(inputList) == 0 {
+ return nil, nil
+ }
+
+ output := fleets.AdditionalLocationsProfile{}
+ outputList := make([]fleets.LocationProfile, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.LocationProfile{
+ Location: input.Location,
+ }
+
+ virtualMachineProfileOverrideValue, err := expandVirtualMachineProfileModel(input.VirtualMachineProfileOverride, d, true, true)
+ if err != nil {
+ return nil, err
+ }
+
+ output.VirtualMachineProfileOverride = virtualMachineProfileOverrideValue
+
+ outputList = append(outputList, output)
+ }
+
+ output.LocationProfiles = outputList
+
+ return &output, nil
+}
+
+func flattenPlanModel(input *fleets.Plan) []PlanModel {
+ outputList := make([]PlanModel, 0)
+ if input == nil {
+ return outputList
+ }
+ output := PlanModel{
+ Name: input.Name,
+ Product: input.Product,
+ Publisher: input.Publisher,
+ }
+
+ output.PromotionCode = pointer.From(input.PromotionCode)
+
+ return append(outputList, output)
+}
+
+func flattenAdditionalLocationProfileModel(input *fleets.AdditionalLocationsProfile, metadata sdk.ResourceMetaData) ([]AdditionalLocationProfileModel, error) {
+ outputList := make([]AdditionalLocationProfileModel, 0)
+ if input == nil {
+ return outputList, nil
+ }
+
+ for _, input := range input.LocationProfiles {
+ output := AdditionalLocationProfileModel{
+ Location: input.Location,
+ }
+ virtualMachineProfileOverrideValue, err := flattenVirtualMachineProfileModel(input.VirtualMachineProfileOverride, metadata, true)
+ if err != nil {
+ return nil, err
+ }
+
+ output.VirtualMachineProfileOverride = virtualMachineProfileOverrideValue
+ outputList = append(outputList, output)
+ }
+
+ return outputList, nil
+}
+
+func flattenSubResourceId(inputList []fleets.SubResource) []string {
+ outputList := make([]string, 0)
+ if len(inputList) == 0 {
+ return outputList
+ }
+ for _, input := range inputList {
+ output := pointer.From(input.Id)
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenIPTagModel(inputList *[]fleets.VirtualMachineScaleSetIPTag) []IPTagModel {
+ outputList := make([]IPTagModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+
+ for _, input := range *inputList {
+ output := IPTagModel{}
+
+ output.Type = pointer.From(input.IPTagType)
+ output.Tag = pointer.From(input.Tag)
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenRegularPriorityProfileModel(input *fleets.RegularPriorityProfile) []RegularPriorityProfileModel {
+ outputList := make([]RegularPriorityProfileModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ output := RegularPriorityProfileModel{}
+ output.AllocationStrategy = string(pointer.From(input.AllocationStrategy))
+ output.Capacity = pointer.From(input.Capacity)
+ output.MinCapacity = pointer.From(input.MinCapacity)
+
+ return append(outputList, output)
+}
+
+func flattenSpotPriorityProfileModel(input *fleets.SpotPriorityProfile) []SpotPriorityProfileModel {
+ outputList := make([]SpotPriorityProfileModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ output := SpotPriorityProfileModel{}
+ output.AllocationStrategy = string(pointer.From(input.AllocationStrategy))
+ output.Capacity = pointer.From(input.Capacity)
+ output.EvictionPolicy = string(pointer.From(input.EvictionPolicy))
+ output.MaintainEnabled = pointer.From(input.Maintain)
+
+ // defaulted since MaxHourlyPricePerVM isn't returned if it's unset
+ maxHourlyPricePerVM := float64(-1.0)
+ if input.MaxPricePerVM != nil {
+ maxHourlyPricePerVM = pointer.From(input.MaxPricePerVM)
+ }
+ output.MaxHourlyPricePerVM = maxHourlyPricePerVM
+
+ output.MinCapacity = pointer.From(input.MinCapacity)
+
+ return append(outputList, output)
+}
+
+func flattenVMAttributesModel(input *fleets.VMAttributes) []VMAttributesModel {
+ outputList := make([]VMAttributesModel, 0)
+ if input == nil {
+ return outputList
+ }
+ output := VMAttributesModel{
+ AcceleratorCount: flattenVMAttributeMinMaxIntegerModel(input.AcceleratorCount),
+ AcceleratorManufacturers: flattenToStringSlice(input.AcceleratorManufacturers),
+ AcceleratorTypes: flattenToStringSlice(input.AcceleratorTypes),
+ ArchitectureTypes: flattenToStringSlice(input.ArchitectureTypes),
+ CpuManufacturers: flattenToStringSlice(input.CpuManufacturers),
+ DataDiskCount: flattenVMAttributeMinMaxIntegerModel(input.DataDiskCount),
+ LocalStorageDiskTypes: flattenToStringSlice(input.LocalStorageDiskTypes),
+ LocalStorageInGib: flattenVMAttributeMinMaxDoubleModel(input.LocalStorageInGiB),
+ MemoryInGib: flattenVMAttributeMinMaxDoubleModel(&input.MemoryInGiB),
+ MemoryInGibPerVCPU: flattenVMAttributeMinMaxDoubleModel(input.MemoryInGiBPerVCPU),
+ NetworkBandwidthInMbps: flattenVMAttributeMinMaxDoubleModel(input.NetworkBandwidthInMbps),
+ NetworkInterfaceCount: flattenVMAttributeMinMaxIntegerModel(input.NetworkInterfaceCount),
+ RdmaNetworkInterfaceCount: flattenVMAttributeMinMaxIntegerModel(input.RdmaNetworkInterfaceCount),
+ VCPUCount: flattenVMAttributeMinMaxIntegerModel(&input.VCPUCount),
+ VMCategories: flattenToStringSlice(input.VMCategories),
+ }
+
+ output.AcceleratorSupport = string(pointer.From(input.AcceleratorSupport))
+ output.BurstableSupport = string(pointer.From(input.BurstableSupport))
+ output.ExcludedVMSizes = pointer.From(input.ExcludedVMSizes)
+ output.LocalStorageSupport = string(pointer.From(input.LocalStorageSupport))
+ output.RdmaSupport = string(pointer.From(input.RdmaSupport))
+
+ return append(outputList, output)
+}
+
+func flattenVMAttributeMinMaxIntegerModel(input *fleets.VMAttributeMinMaxInteger) []VMAttributeMinMaxIntegerModel {
+ outputList := make([]VMAttributeMinMaxIntegerModel, 0)
+ if input == nil {
+ return outputList
+ }
+ output := VMAttributeMinMaxIntegerModel{}
+ output.Max = pointer.From(input.Max)
+ output.Min = pointer.From(input.Min)
+
+ return append(outputList, output)
+}
+
+func flattenVMAttributeMinMaxDoubleModel(input *fleets.VMAttributeMinMaxDouble) []VMAttributeMinMaxDoubleModel {
+ outputList := make([]VMAttributeMinMaxDoubleModel, 0)
+ if input == nil {
+ return outputList
+ }
+ output := VMAttributeMinMaxDoubleModel{}
+ output.Max = pointer.From(input.Max)
+ output.Min = pointer.From(input.Min)
+
+ return append(outputList, output)
+}
+
+func flattenToStringSlice[T any](inputList *[]T) []string {
+ outputList := make([]string, 0)
+ if inputList == nil {
+ return outputList
+ }
+
+ result := make([]string, len(*inputList))
+ for i, v := range *inputList {
+ result[i] = fmt.Sprintf("%v", v)
+ }
+
+ return result
+}
+
+func flattenVMSizeProfileModel(inputList *[]fleets.VMSizeProfile) []VMSizeProfileModel {
+ outputList := make([]VMSizeProfileModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+
+ for _, input := range *inputList {
+ output := VMSizeProfileModel{
+ Name: input.Name,
+ }
+ output.Rank = pointer.From(input.Rank)
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_test.go b/internal/services/computefleet/compute_fleet_resource_test.go
new file mode 100644
index 000000000000..2cd3320d612e
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_test.go
@@ -0,0 +1,913 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/go-azure-helpers/lang/pointer"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/clients"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
+)
+
+type ComputeFleetTestResource struct{}
+
+func TestAccComputeFleet_basic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.basic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep("virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_requiresImport(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.basic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.RequiresImportErrorStep(r.requiresImport),
+ })
+}
+
+func TestAccComputeFleet_completeExceptVMSS(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.completeExceptVMSS(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep("virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_update(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.completeExceptVMSS(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.completeExceptVMSSUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.completeExceptVMSS(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
+ id, err := fleets.ParseFleetID(state.ID)
+ if err != nil {
+ return nil, err
+ }
+
+ resp, err := clients.ComputeFleet.ComputeFleetClient.Get(ctx, *id)
+ if err != nil {
+ return nil, fmt.Errorf("retrieving %s: %+v", id, err)
+ }
+ return pointer.To(resp.Model != nil), nil
+}
+
+func (r ComputeFleetTestResource) template(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {}
+}
+
+%[1]s
+
+`, r.templateWithOutProvider(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) templateWithOutProvider(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+locals {
+ first_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
+ second_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/NDMj2wG6bSa6jbn6E3LYlUsYiWMp1CQ2sGAijPALW6OrSu30lz7nKpoh8Qdw7/A4nAJgweI5Oiiw5/BOaGENM70Go+VM8LQMSxJ4S7/8MIJEZQp5HcJZ7XDTcEwruknrd8mllEfGyFzPvJOx6QAQocFhXBW6+AlhM3gn/dvV5vdrO8ihjET2GoDUqXPYC57ZuY+/Fz6W3KV8V97BvNUhpY5yQrP5VpnyvvXNFQtzDfClTvZFPuoHQi3/KYPi6O0FSD74vo8JOBZZY09boInPejkm9fvHQqfh0bnN7B6XJoUwC1Qprrx+XIy7ust5AEn5XL7d4lOvcR14MxDDKEp you@me.com"
+ first_ed25519_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDqzSi9IHoYnbE3YQ+B2fQEVT8iGFemyPovpEtPziIVB you@me.com"
+ second_ed25519_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDqzSi9IHoYnbE3YQ+B2fQEVT8iGFemyPovpEtPziIVB hello@world.com"
+ admin_username = "testadmin1234"
+ admin_password = "Password1234!"
+ admin_password_update = "Password1234!Update"
+}
+
+resource "azurerm_resource_group" "test" {
+ name = "acctest-rg-fleet-%[1]d"
+ location = "%[2]s"
+}
+
+resource "azurerm_virtual_network" "test" {
+ name = "acctvn-%[1]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+}
+
+resource "azurerm_subnet" "test" {
+ name = "acctsub-%[1]d"
+ resource_group_name = azurerm_resource_group.test.name
+ virtual_network_name = azurerm_virtual_network.test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "test" {
+ name = "acctestpublicIP-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "test" {
+ name = "acctest-loadbalancer-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "test" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.test.id
+}
+`, data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) baseAndAdditionalLocationLinuxTemplate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_resource_group" "linux_test" {
+ name = "acctest-rg-fleet-al-%[2]d"
+ location = "%[3]s"
+}
+
+resource "azurerm_virtual_network" "linux_test" {
+ name = "acctvn-al-%[2]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+}
+
+resource "azurerm_subnet" "linux_test" {
+ name = "acctsub-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ virtual_network_name = azurerm_virtual_network.linux_test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "linux_test" {
+ name = "acctestpublicIP%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "linux_test" {
+ name = "acctest-loadbalancer-%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.linux_test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "linux_test" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.linux_test.id
+}
+`, r.template(data), data.RandomInteger, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) baseAndAdditionalLocationWindowsTemplate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_resource_group" "windows_test" {
+ name = "acctest-rg-fleet-al-win-%[2]d"
+ location = "%[3]s"
+}
+
+resource "azurerm_virtual_network" "windows_test" {
+ name = "acctvn-al-win-%[2]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+}
+
+resource "azurerm_subnet" "windows_test" {
+ name = "acctsub-al-win-%[2]d"
+ resource_group_name = azurerm_resource_group.windows_test.name
+ virtual_network_name = azurerm_virtual_network.windows_test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "windows_test" {
+ name = "acctestpublicIP-al-%[2]d"
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "windows_test" {
+ name = "acctest-loadbalancer-al-%[2]d"
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal-al-%[2]d"
+ public_ip_address_id = azurerm_public_ip.windows_test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "windows_test" {
+ name = "internal-al"
+ loadbalancer_id = azurerm_lb.windows_test.id
+}
+`, r.template(data), data.RandomInteger, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) baseAndAdditionalLocationLinuxTemplateWithOutProvider(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_resource_group" "linux_test" {
+ name = "acctest-rg-fleet-al-%[2]d"
+ location = "%[3]s"
+}
+
+resource "azurerm_virtual_network" "linux_test" {
+ name = "acctvn-al-%[2]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+}
+
+resource "azurerm_subnet" "linux_test" {
+ name = "acctsub-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ virtual_network_name = azurerm_virtual_network.linux_test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "linux_test" {
+ name = "acctestpublicIP%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "linux_test" {
+ name = "acctest-loadbalancer-%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.linux_test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "linux_test" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.linux_test.id
+}
+`, r.templateWithOutProvider(data), data.RandomInteger, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) baseAndAdditionalLocationWindowsTemplateWithOutProvider(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_resource_group" "windows_test" {
+ name = "acctest-rg-fleet-al-win-%[2]d"
+ location = "%[3]s"
+}
+
+resource "azurerm_virtual_network" "windows_test" {
+ name = "acctvn-al-win-%[2]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+}
+
+resource "azurerm_subnet" "windows_test" {
+ name = "acctsub-al-win-%[2]d"
+ resource_group_name = azurerm_resource_group.windows_test.name
+ virtual_network_name = azurerm_virtual_network.windows_test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "windows_test" {
+ name = "acctestpublicIP-al-%[2]d"
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "windows_test" {
+ name = "acctest-loadbalancer-al-%[2]d"
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal-al-%[2]d"
+ public_ip_address_id = azurerm_public_ip.windows_test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "windows_test" {
+ name = "internal-al"
+ loadbalancer_id = azurerm_lb.windows_test.id
+}
+`, r.templateWithOutProvider(data), data.RandomInteger, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) basic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ # ignore_changes os_disk as os_disk block is not specified the API return default values for caching, delete_option, disk_size_in_gb and storage_account_type
+ # ignore_changes compute_api_version as the default value returned by API will be the latest supported computeApiVersion if it is not specified
+ lifecycle {
+ ignore_changes = [compute_api_version, virtual_machine_profile.0.os_disk]
+ }
+}
+`, r.template(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) requiresImport(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%s
+
+resource "azurerm_compute_fleet" "import" {
+ name = azurerm_compute_fleet.test.name
+ resource_group_name = azurerm_compute_fleet.test.resource_group_name
+ location = azurerm_compute_fleet.test.location
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ # ignore_changes os_disk as os_disk block is not specified the API return default values for caching, delete_option, disk_size_in_gb and storage_account_type
+ # ignore_changes compute_api_version as the default value returned by API will be the latest supported computeApiVersion if it is not specified
+ lifecycle {
+ ignore_changes = [compute_api_version, virtual_machine_profile.0.os_disk]
+ }
+}
+`, r.basic(data))
+}
+
+func (r ComputeFleetTestResource) completeExceptVMSS(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+ %[1]s
+
+resource "azurerm_marketplace_agreement" "barracuda" {
+ publisher = "micro-focus"
+ offer = "arcsight-logger"
+ plan = "arcsight_logger_72_byol"
+}
+
+resource "azurerm_user_assigned_identity" "test" {
+ name = "acctest%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+}
+
+resource "azurerm_user_assigned_identity" "test2" {
+ name = "acctest2%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 1
+ compute_api_version = "2024-03-01"
+
+ identity {
+ type = "UserAssigned"
+ identity_ids = [azurerm_user_assigned_identity.test.id]
+ }
+
+ plan {
+ name = "arcsight_logger_72_byol"
+ product = "arcsight-logger"
+ publisher = "micro-focus"
+ promotion_code = "test"
+ }
+
+ spot_priority_profile {
+ allocation_strategy = "PriceCapacityOptimized"
+ eviction_policy = "Delete"
+ max_hourly_price_per_vm = -1
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ regular_priority_profile {
+ allocation_strategy = "LowestPrice"
+ capacity = 0
+ min_capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1"
+ }
+
+ vm_attributes {
+ memory_in_gib {
+ max = 150
+ min = 1
+ }
+ vcpu_count {
+ max = 10
+ min = 1
+ }
+ data_disk_count {
+ max = 10
+ min = 1
+ }
+ local_storage_in_gib {
+ max = 100
+ min = 1
+ }
+ memory_in_gib_per_vcpu {
+ max = 10
+ min = 0
+ }
+ local_storage_support = "Included"
+ local_storage_disk_types = ["SSD"]
+ architecture_types = ["X64"]
+ cpu_manufacturers = ["Intel"]
+ network_bandwidth_in_mbps {
+ max = 500
+ min = 0
+ }
+ network_interface_count {
+ max = 10
+ min = 0
+ }
+ vm_categories = ["GeneralPurpose"]
+ burstable_support = "Excluded"
+ rdma_support = "Included"
+ rdma_network_interface_count {
+ max = 10
+ min = 0
+ }
+ accelerator_support = "Included"
+ accelerator_count {
+ max = 3
+ min = 0
+ }
+ }
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "micro-focus"
+ offer = "arcsight-logger"
+ sku = "arcsight_logger_72_byol"
+ version = "7.2.0"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ caching = "ReadWrite"
+ create_option = "FromImage"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ tags = {
+ Hello = "There"
+ World = "Example"
+ }
+ zones = ["1", "2", "3"]
+
+ depends_on = [azurerm_marketplace_agreement.barracuda]
+}
+ `, r.template(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) completeExceptVMSSUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+ %[1]s
+
+resource "azurerm_marketplace_agreement" "barracuda" {
+ publisher = "micro-focus"
+ offer = "arcsight-logger"
+ plan = "arcsight_logger_72_byol"
+}
+
+resource "azurerm_user_assigned_identity" "test" {
+ name = "acctest%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+}
+
+resource "azurerm_user_assigned_identity" "test2" {
+ name = "acctest2%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 1
+ compute_api_version = "2023-09-01"
+
+ identity {
+ type = "UserAssigned"
+ identity_ids = [azurerm_user_assigned_identity.test2.id]
+ }
+
+ plan {
+ name = "arcsight_logger_72_byol"
+ product = "arcsight-logger"
+ publisher = "micro-focus"
+ promotion_code = "test"
+ }
+
+ spot_priority_profile {
+ allocation_strategy = "PriceCapacityOptimized"
+ eviction_policy = "Delete"
+ max_hourly_price_per_vm = -1
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ regular_priority_profile {
+ allocation_strategy = "LowestPrice"
+ capacity = 0
+ min_capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1"
+ }
+
+ vm_attributes {
+ memory_in_gib {
+ max = 151
+ min = 0
+ }
+ vcpu_count {
+ max = 11
+ min = 0
+ }
+ data_disk_count {
+ max = 11
+ min = 0
+ }
+ local_storage_in_gib {
+ max = 101
+ min = 1
+ }
+ memory_in_gib_per_vcpu {
+ max = 11
+ min = 0
+ }
+ local_storage_support = "Included"
+ local_storage_disk_types = ["HDD", "SSD"]
+ architecture_types = ["X64", "ARM64"]
+ cpu_manufacturers = ["Intel", "Microsoft"]
+ network_bandwidth_in_mbps {
+ max = 501
+ min = 0
+ }
+ network_interface_count {
+ max = 11
+ min = 0
+ }
+ vm_categories = ["GeneralPurpose", "ComputeOptimized"]
+ burstable_support = "Included"
+ rdma_support = "Included"
+ rdma_network_interface_count {
+ max = 11
+ min = 0
+ }
+ accelerator_support = "Included"
+ accelerator_count {
+ max = 4
+ min = 0
+ }
+ }
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "micro-focus"
+ offer = "arcsight-logger"
+ sku = "arcsight_logger_72_byol"
+ version = "7.2.0"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ caching = "ReadWrite"
+ create_option = "FromImage"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ tags = {
+ Hello = "ThereUpdate"
+ World = "ExampleUpdate"
+ }
+ zones = ["1", "2", "3"]
+
+ depends_on = [azurerm_marketplace_agreement.barracuda]
+}
+ `, r.template(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) basicBaseLinuxVirtualMachineProfile() string {
+ return `
+virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+}
+# ignore_changes as when os_disk block is not specified the API return default values for caching, delete_option, disk_size_in_gb and storage_account_type
+lifecycle {
+ ignore_changes = [virtual_machine_profile.0.os_disk, additional_location_profile.0.virtual_machine_profile_override.0.os_disk]
+}
+`
+}
+
+func (r ComputeFleetTestResource) basicBaseWindowsVirtualMachineProfile() string {
+ return `
+virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+}
+# ignore_changes as when os_disk block is not specified the API return default values for caching, delete_option, disk_size_in_gb and storage_account_type
+lifecycle {
+ ignore_changes = [virtual_machine_profile.0.os_disk, additional_location_profile[0].virtual_machine_profile_override.0.os_disk]
+}
+`
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_auth_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_auth_test.go
new file mode 100644
index 000000000000..78afe1b64ac0
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_auth_test.go
@@ -0,0 +1,1054 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileAuth_authPassword(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.authPassword(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password"),
+ {
+ Config: r.authPasswordUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileAuth_authSSHKey(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.authSSHKey(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ {
+ Config: r.authSSHKeyUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileAuth_authMultipleSSHPublicKeys(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.authMultipleSSHPublicKeys(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ {
+ Config: r.authMultipleSSHPublicKeysUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileAuth_authSSHKeyAndPassword(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.authSSHKeyAndPassword(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.authSSHKeyAndPasswordUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileAuth_authEd25519SSHPublicKeys(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.authEd25519SSHPublicKeys(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ {
+ Config: r.authEd25519SSHPublicKeysUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(),
+ })
+}
+
+func (r ComputeFleetTestResource) authPassword(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.windows_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.windows_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authPasswordUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password_update
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password_update
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.windows_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.windows_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authSSHKey(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authSSHKeyUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authMultipleSSHPublicKeys(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key, local.second_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key, local.second_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authMultipleSSHPublicKeysUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_public_key, local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_public_key, local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authSSHKeyAndPassword(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ admin_ssh_keys = [local.first_public_key]
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ admin_ssh_keys = [local.first_public_key]
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authSSHKeyAndPasswordUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password_update
+ admin_ssh_keys = [local.second_public_key]
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password_update
+ admin_ssh_keys = [local.second_public_key]
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authEd25519SSHPublicKeys(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_ed25519_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+ additional_location_profile {
+
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_ed25519_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) authEd25519SSHPublicKeysUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_ed25519_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ primary = true
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.second_ed25519_public_key]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ primary = true
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_data_disk_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_data_disk_test.go
new file mode 100644
index 000000000000..2447be48372a
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_data_disk_test.go
@@ -0,0 +1,645 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileDataDisk_basic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.dataDiskBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileDataDisk_complete(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.dataDiskComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileDataDisk_update(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.dataDiskComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.dataDiskCompleteUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.dataDiskBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.dataDiskComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) dataDiskBasic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ lun = 0
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ lun = 0
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) dataDiskComplete(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_M8ms"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ lun = 0
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ disk_encryption_set_id = azurerm_disk_encryption_set.test.id
+ storage_account_type = "Premium_LRS"
+ write_accelerator_enabled = true
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ lun = 0
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ disk_encryption_set_id = azurerm_disk_encryption_set.linux_test.id
+ storage_account_type = "Premium_LRS"
+ write_accelerator_enabled = true
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.diskEncryptionSetResourceDependencies(data), r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) dataDiskCompleteUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_M8ms"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 11
+ lun = 1
+ caching = "ReadWrite"
+ delete_option = "Detach"
+ disk_encryption_set_id = azurerm_disk_encryption_set.test.id
+ storage_account_type = "Premium_ZRS"
+ write_accelerator_enabled = false
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ data_disk {
+ create_option = "Empty"
+ disk_size_in_gb = 11
+ lun = 1
+ caching = "ReadWrite"
+ delete_option = "Detach"
+ disk_encryption_set_id = azurerm_disk_encryption_set.linux_test.id
+ storage_account_type = "Premium_ZRS"
+ write_accelerator_enabled = false
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+ depends_on = [
+ "azurerm_role_assignment.disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.disk-encryption",
+ "azurerm_role_assignment.linux-test-disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.linux-test-disk-encryption",
+ ]
+}
+`, r.diskEncryptionSetResourceDependencies(data), r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) diskEncryptionSetResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_keys_on_destroy = false
+ }
+ }
+}
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkv%[1]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ purge_protection_enabled = true
+ enabled_for_disk_encryption = true
+}
+
+resource "azurerm_key_vault_access_policy" "service-principal" {
+ key_vault_id = azurerm_key_vault.test.id
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ key_permissions = [
+ "Create",
+ "Delete",
+ "Recover",
+ "Get",
+ "Purge",
+ "Update",
+ "GetRotationPolicy",
+ ]
+
+ secret_permissions = [
+ "Get",
+ "Delete",
+ "Set",
+ ]
+}
+
+resource "azurerm_key_vault_key" "test" {
+ name = "examplekey"
+ key_vault_id = azurerm_key_vault.test.id
+ key_type = "RSA"
+ key_size = 2048
+
+ key_opts = [
+ "decrypt",
+ "encrypt",
+ "sign",
+ "unwrapKey",
+ "verify",
+ "wrapKey",
+ ]
+
+ depends_on = ["azurerm_key_vault_access_policy.service-principal"]
+}
+
+resource "azurerm_disk_encryption_set" "test" {
+ name = "acctestdes-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ key_vault_key_id = azurerm_key_vault_key.test.id
+
+ identity {
+ type = "SystemAssigned"
+ }
+}
+
+resource "azurerm_key_vault_access_policy" "disk-encryption" {
+ key_vault_id = azurerm_key_vault.test.id
+
+ key_permissions = [
+ "Get",
+ "WrapKey",
+ "UnwrapKey",
+ "GetRotationPolicy",
+ ]
+
+ tenant_id = azurerm_disk_encryption_set.test.identity.0.tenant_id
+ object_id = azurerm_disk_encryption_set.test.identity.0.principal_id
+}
+
+
+resource "azurerm_role_assignment" "disk-encryption-read-keyvault" {
+ scope = azurerm_key_vault.test.id
+ role_definition_name = "Reader"
+ principal_id = azurerm_disk_encryption_set.test.identity.0.principal_id
+}
+
+
+resource "azurerm_key_vault" "linux_test" {
+ name = "acctestkvlinux%[1]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ purge_protection_enabled = true
+ enabled_for_disk_encryption = true
+}
+
+resource "azurerm_key_vault_access_policy" "linux-test-service-principal" {
+ key_vault_id = azurerm_key_vault.linux_test.id
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ key_permissions = [
+ "Create",
+ "Delete",
+ "Recover",
+ "Get",
+ "Purge",
+ "Update",
+ "GetRotationPolicy",
+ ]
+
+ secret_permissions = [
+ "Get",
+ "Delete",
+ "Set",
+ ]
+}
+
+resource "azurerm_key_vault_key" "linux_test" {
+ name = "examplekey"
+ key_vault_id = azurerm_key_vault.linux_test.id
+ key_type = "RSA"
+ key_size = 2048
+
+ key_opts = [
+ "decrypt",
+ "encrypt",
+ "sign",
+ "unwrapKey",
+ "verify",
+ "wrapKey",
+ ]
+
+ depends_on = ["azurerm_key_vault_access_policy.linux-test-service-principal"]
+}
+
+resource "azurerm_disk_encryption_set" "linux_test" {
+ name = "acctestdes-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ key_vault_key_id = azurerm_key_vault_key.linux_test.id
+
+ identity {
+ type = "SystemAssigned"
+ }
+}
+
+resource "azurerm_key_vault_access_policy" "linux-test-disk-encryption" {
+ key_vault_id = azurerm_key_vault.linux_test.id
+
+ key_permissions = [
+ "Get",
+ "WrapKey",
+ "UnwrapKey",
+ "GetRotationPolicy",
+ ]
+
+ tenant_id = azurerm_disk_encryption_set.linux_test.identity.0.tenant_id
+ object_id = azurerm_disk_encryption_set.linux_test.identity.0.principal_id
+}
+
+
+resource "azurerm_role_assignment" "linux-test-disk-encryption-read-keyvault" {
+ scope = azurerm_key_vault.linux_test.id
+ role_definition_name = "Reader"
+ principal_id = azurerm_disk_encryption_set.linux_test.identity.0.principal_id
+}
+`, data.RandomString, data.RandomInteger)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_extensions_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_extensions_test.go
new file mode 100644
index 000000000000..835ca9ecf0a1
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_extensions_test.go
@@ -0,0 +1,1054 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileExtensions_basic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.extensionsBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileExtensions_update(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.extensionsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.extension.2.protected_settings_json",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.extension.2.protected_settings_json"),
+ {
+ Config: r.extensionsCompleteUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.extension.2.protected_settings_json",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.extension.2.protected_settings_json"),
+ {
+ Config: r.extensionsBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep("virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.extensionsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.extension.2.protected_settings_json",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.extension.2.protected_settings_json"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileExtensions_complete(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.extensionsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.extension.2.protected_settings_json",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.extension.2.protected_settings_json"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileExtensions_protectedSettingsFromKeyVault(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.extensionsProtectedSettingsFromKeyVault(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.extensionsProtectedSettingsFromKeyVaultUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) extensionsBasic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 2
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) extensionsComplete(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 2
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension_operations_enabled = true
+ extension {
+ name = "testOmsAgentForLinux"
+ publisher = "Microsoft.EnterpriseCloud.Monitoring"
+ type = "OmsAgentForLinux"
+ type_handler_version = "1.12"
+ auto_upgrade_minor_version_enabled = true
+ automatic_upgrade_enabled = true
+ failure_suppression_enabled = true
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ auto_upgrade_minor_version_enabled = true
+ }
+
+ extension {
+ name = "Docker"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "DockerExtension"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+ extensions_to_provision_after_vm_creation = ["CustomScript"]
+ force_extension_execution_on_change = "test"
+
+ settings_json = jsonencode({
+ "commandToExecute" = "echo $HOSTNAME"
+ })
+
+ protected_settings_json = jsonencode({
+ "managedIdentity" = {}
+ })
+ }
+ extensions_time_budget = "PT30M"
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension_operations_enabled = true
+ extension {
+ name = "testOmsAgentForLinux"
+ publisher = "Microsoft.EnterpriseCloud.Monitoring"
+ type = "OmsAgentForLinux"
+ type_handler_version = "1.12"
+ auto_upgrade_minor_version_enabled = true
+ automatic_upgrade_enabled = true
+ failure_suppression_enabled = true
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ auto_upgrade_minor_version_enabled = true
+ }
+
+ extension {
+ name = "Docker"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "DockerExtension"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+ extensions_to_provision_after_vm_creation = ["CustomScript"]
+ force_extension_execution_on_change = "test"
+
+ settings_json = jsonencode({
+ "commandToExecute" = "echo $HOSTNAME"
+ })
+
+ protected_settings_json = jsonencode({
+ "managedIdentity" = {}
+ })
+ }
+ extensions_time_budget = "PT30M"
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) extensionsCompleteUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 2
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension_operations_enabled = true
+ extension {
+ name = "testOmsAgentForLinux"
+ publisher = "Microsoft.EnterpriseCloud.Monitoring"
+ type = "OmsAgentForLinux"
+ type_handler_version = "1.12"
+ auto_upgrade_minor_version_enabled = false
+ automatic_upgrade_enabled = false
+ failure_suppression_enabled = false
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ auto_upgrade_minor_version_enabled = true
+ }
+
+ extension {
+ name = "Docker"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "DockerExtension"
+ type_handler_version = "1.0"
+
+ auto_upgrade_minor_version_enabled = false
+ extensions_to_provision_after_vm_creation = ["CustomScript"]
+ force_extension_execution_on_change = "testUpdate"
+
+ settings_json = jsonencode({
+ "commandToExecute" = "echo $(date)"
+ })
+
+ protected_settings_json = jsonencode({
+ "reset_ssh" = "True"
+ })
+ }
+ extensions_time_budget = "PT1H"
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension_operations_enabled = true
+ extension {
+ name = "testOmsAgentForLinux"
+ publisher = "Microsoft.EnterpriseCloud.Monitoring"
+ type = "OmsAgentForLinux"
+ type_handler_version = "1.12"
+ auto_upgrade_minor_version_enabled = false
+ automatic_upgrade_enabled = false
+ failure_suppression_enabled = false
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.0"
+ auto_upgrade_minor_version_enabled = true
+ }
+
+ extension {
+ name = "Docker"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "DockerExtension"
+ type_handler_version = "1.0"
+
+ auto_upgrade_minor_version_enabled = false
+ extensions_to_provision_after_vm_creation = ["CustomScript"]
+ force_extension_execution_on_change = "testUpdate"
+
+ settings_json = jsonencode({
+ "commandToExecute" = "echo $(date)"
+ })
+
+ protected_settings_json = jsonencode({
+ "reset_ssh" = "True"
+ })
+ }
+ extensions_time_budget = "PT1H"
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) extensionsProtectedSettingsFromKeyVault(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_keys_on_destroy = false
+ purge_soft_deleted_secrets_on_destroy = false
+ }
+ }
+}
+
+%[1]s
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkv1%[5]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "test" {
+ name = "secret"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.test.id
+}
+
+resource "azurerm_key_vault" "linux_test" {
+ name = "acctestkv2%[5]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "linux_test" {
+ name = "secret"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.linux_test.id
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 2
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.1"
+
+ protected_settings_from_key_vault {
+ secret_url = azurerm_key_vault_secret.test.id
+ source_vault_id = azurerm_key_vault.test.id
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.1"
+
+ protected_settings_from_key_vault {
+ secret_url = azurerm_key_vault_secret.linux_test.id
+ source_vault_id = azurerm_key_vault.linux_test.id
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary, data.RandomString)
+}
+
+func (r ComputeFleetTestResource) extensionsProtectedSettingsFromKeyVaultUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_keys_on_destroy = false
+ purge_soft_deleted_secrets_on_destroy = false
+ }
+ }
+}
+
+%[1]s
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkv1%[5]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "test" {
+ name = "secret"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.test.id
+}
+
+resource "azurerm_key_vault" "linux_test" {
+ name = "acctestkv2%[5]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "linux_test" {
+ name = "secret"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.linux_test.id
+}
+
+
+resource "azurerm_key_vault" "test2" {
+ name = "acctestkv12%[5]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "test2" {
+ name = "secret2"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.test.id
+}
+
+resource "azurerm_key_vault" "linux_test2" {
+ name = "acctestkv22%[5]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ secret_permissions = [
+ "Delete",
+ "Get",
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_secret" "linux_test2" {
+ name = "secret2"
+ value = "{\"commandToExecute\":\"echo $HOSTNAME\"}"
+ key_vault_id = azurerm_key_vault.linux_test.id
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 2
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.1"
+
+ protected_settings_from_key_vault {
+ secret_url = azurerm_key_vault_secret.test2.id
+ source_vault_id = azurerm_key_vault.test2.id
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ extension {
+ name = "CustomScript"
+ publisher = "Microsoft.Azure.Extensions"
+ type = "CustomScript"
+ type_handler_version = "2.1"
+
+ protected_settings_from_key_vault {
+ secret_url = azurerm_key_vault_secret.linux_test2.id
+ source_vault_id = azurerm_key_vault.linux_test2.id
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary, data.RandomString)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_image_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_image_test.go
new file mode 100644
index 000000000000..87ad19e5b1ab
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_image_test.go
@@ -0,0 +1,1461 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "context"
+ "fmt"
+ "log"
+ "testing"
+ "time"
+
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-03-01/virtualmachines"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-05-01/networkinterfaces"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-05-01/publicipaddresses"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/ssh"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/clients"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
+)
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromImageSourceReference(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromSourceImageReferenceUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromImageId(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromImageId(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromCommunitySharedImageGallery(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromCommunitySharedImageGallery(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromCommunitySharedImageGalleryVersion(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromCommunitySharedImageGalleryVersion(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromSharedImageGallery(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromSharedImageGallery(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileImage_imageFromSharedImageGalleryVersion(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.imageFromSourceImageReference(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.source"),
+ data.CheckWithClientForResource(r.generalizeVirtualMachine(), "azurerm_linux_virtual_machine.linux-test-source"),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.imageFromSharedImageGalleryVersion(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) imageFromExistingMachinePrep(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ virtual_machine {
+ delete_os_disk_on_deletion = true
+ skip_shutdown_and_force_delete = true
+ }
+ }
+}
+
+%[1]s
+
+resource "azurerm_public_ip" "public" {
+ name = "acctpip-%[2]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ allocation_method = "Static"
+ domain_name_label = "acctestsourcevm-%[2]d"
+ sku = "Basic"
+}
+
+resource "azurerm_network_interface" "public" {
+ name = "acctestnic-%[2]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ ip_configuration {
+ name = "testconfigurationsource"
+ subnet_id = azurerm_subnet.test.id
+ private_ip_address_allocation = "Dynamic"
+ public_ip_address_id = azurerm_public_ip.public.id
+ }
+}
+
+resource "azurerm_linux_virtual_machine" "source" {
+ name = "acctestsourceVM-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ size = "Standard_DS1_v2"
+ admin_username = local.admin_username
+ disable_password_authentication = false
+ admin_password = local.admin_password
+
+ network_interface_ids = [
+ azurerm_network_interface.public.id,
+ ]
+
+ admin_ssh_key {
+ username = local.admin_username
+ public_key = local.first_public_key
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+}
+
+resource "azurerm_public_ip" "linux-test-public" {
+ name = "acctpip-%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ allocation_method = "Static"
+ domain_name_label = "acctestsourcevm-%[2]d"
+ sku = "Basic"
+}
+
+resource "azurerm_network_interface" "linux-test-public" {
+ name = "acctestnic-%[2]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ ip_configuration {
+ name = "testconfigurationsource"
+ subnet_id = azurerm_subnet.linux_test.id
+ private_ip_address_allocation = "Dynamic"
+ public_ip_address_id = azurerm_public_ip.linux-test-public.id
+ }
+}
+
+resource "azurerm_linux_virtual_machine" "linux-test-source" {
+ name = "acctestsourceVM-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ size = "Standard_DS1_v2"
+ admin_username = local.admin_username
+ disable_password_authentication = false
+ admin_password = local.admin_password
+
+ network_interface_ids = [
+ azurerm_network_interface.linux-test-public.id,
+ ]
+
+ admin_ssh_key {
+ username = local.admin_username
+ public_key = local.first_public_key
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger)
+}
+
+func (r ComputeFleetTestResource) imageFromSourceImageReference(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-refer-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ compute_api_version = "2024-03-01"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.imageFromExistingMachinePrep(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromSourceImageReferenceUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-refer-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.imageFromExistingMachinePrep(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromImageId(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_image" "test" {
+ name = "test"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.source.id
+}
+
+resource "azurerm_image" "linux_test" {
+ name = "testlinux"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.linux-test-source.id
+}
+
+resource "azurerm_compute_fleet" "image_id" {
+ name = "acctest-fleet-id-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_image.test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_image.linux_test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ }
+ }
+ }
+}
+`, r.imageFromSourceImageReference(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromSharedImageGallery(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_image" "test" {
+ name = "test"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.source.id
+}
+
+resource "azurerm_shared_image_gallery" "test" {
+ name = "acctestsig%[2]d"
+ resource_group_name = "${azurerm_resource_group.test.name}"
+ location = "${azurerm_resource_group.test.location}"
+}
+
+resource "azurerm_shared_image" "test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.test.name
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "test" {
+ name = "1.0.1"
+ gallery_name = azurerm_shared_image.test.gallery_name
+ image_name = azurerm_shared_image.test.name
+ resource_group_name = azurerm_shared_image.test.resource_group_name
+ location = azurerm_shared_image.test.location
+ managed_image_id = azurerm_image.test.id
+
+ target_region {
+ name = azurerm_shared_image.test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_image" "linux_test" {
+ name = "test"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.linux-test-source.id
+}
+
+resource "azurerm_shared_image_gallery" "linux_test" {
+ name = "acctestsiglinux%[2]d"
+ resource_group_name = "${azurerm_resource_group.linux_test.name}"
+ location = "${azurerm_resource_group.linux_test.location}"
+}
+
+resource "azurerm_shared_image" "linux_test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.linux_test.name
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "linux_test" {
+ name = "1.0.1"
+ gallery_name = azurerm_shared_image.linux_test.gallery_name
+ image_name = azurerm_shared_image.linux_test.name
+ resource_group_name = azurerm_shared_image.linux_test.resource_group_name
+ location = azurerm_shared_image.linux_test.location
+ managed_image_id = azurerm_image.linux_test.id
+
+ target_region {
+ name = azurerm_shared_image.linux_test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_compute_fleet" "image_id" {
+ name = "acctest-fleet-id-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_shared_image.test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_shared_image.linux_test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ }
+ }
+ }
+ depends_on = [azurerm_shared_image_version.test, azurerm_shared_image_version.linux_test]
+}
+`, r.imageFromSourceImageReference(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromSharedImageGalleryVersion(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+
+%[1]s
+
+resource "azurerm_image" "test" {
+ name = "test"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.source.id
+}
+
+resource "azurerm_shared_image_gallery" "test" {
+ name = "acctestsig%[2]d"
+ resource_group_name = "${azurerm_resource_group.test.name}"
+ location = "${azurerm_resource_group.test.location}"
+}
+
+resource "azurerm_shared_image" "test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.test.name
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.test.gallery_name
+ image_name = azurerm_shared_image.test.name
+ resource_group_name = azurerm_shared_image.test.resource_group_name
+ location = azurerm_shared_image.test.location
+ managed_image_id = azurerm_image.test.id
+
+ target_region {
+ name = azurerm_shared_image.test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_image" "linux_test" {
+ name = "test"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.linux-test-source.id
+}
+
+resource "azurerm_shared_image_gallery" "linux_test" {
+ name = "acctestsiglinux%[2]d"
+ resource_group_name = "${azurerm_resource_group.linux_test.name}"
+ location = "${azurerm_resource_group.linux_test.location}"
+}
+
+resource "azurerm_shared_image" "linux_test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.linux_test.name
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "linux_test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.linux_test.gallery_name
+ image_name = azurerm_shared_image.linux_test.name
+ resource_group_name = azurerm_shared_image.linux_test.resource_group_name
+ location = azurerm_shared_image.linux_test.location
+ managed_image_id = azurerm_image.linux_test.id
+
+ target_region {
+ name = azurerm_shared_image.linux_test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_compute_fleet" "image_id" {
+ name = "acctest-fleet-id-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_shared_image_version.test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ }
+ }
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_id = azurerm_shared_image_version.linux_test.id
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ }
+ }
+ }
+}
+`, r.imageFromSourceImageReference(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromCommunitySharedImageGallery(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_image" "test" {
+ name = "test"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.source.id
+}
+
+resource "azurerm_shared_image_gallery" "test" {
+ name = "acctestsig%[2]d"
+ resource_group_name = "${azurerm_resource_group.test.name}"
+ location = "${azurerm_resource_group.test.location}"
+
+ sharing {
+ permission = "Community"
+ community_gallery {
+ eula = "https://eula.net"
+ prefix = "prefix"
+ publisher_email = "publisher@test.net"
+ publisher_uri = "https://publisher.net"
+ }
+ }
+}
+
+resource "azurerm_shared_image" "test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.test.name
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.test.gallery_name
+ image_name = azurerm_shared_image.test.name
+ resource_group_name = azurerm_shared_image.test.resource_group_name
+ location = azurerm_shared_image.test.location
+ managed_image_id = azurerm_image.test.id
+
+ target_region {
+ name = azurerm_shared_image.test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_image" "linux_test" {
+ name = "test"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.linux-test-source.id
+}
+
+resource "azurerm_shared_image_gallery" "linux_test" {
+ name = "acctestsiglinux%[2]d"
+ resource_group_name = "${azurerm_resource_group.linux_test.name}"
+ location = "${azurerm_resource_group.linux_test.location}"
+
+ sharing {
+ permission = "Community"
+ community_gallery {
+ eula = "https://eula.net"
+ prefix = "prefix"
+ publisher_email = "publisher@test.net"
+ publisher_uri = "https://publisher.net"
+ }
+ }
+}
+
+resource "azurerm_shared_image" "linux_test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.linux_test.name
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "linux_test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.linux_test.gallery_name
+ image_name = azurerm_shared_image.linux_test.name
+ resource_group_name = azurerm_shared_image.linux_test.resource_group_name
+ location = azurerm_shared_image.linux_test.location
+ managed_image_id = azurerm_image.linux_test.id
+
+ target_region {
+ name = azurerm_shared_image.linux_test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_compute_fleet" "image_id" {
+ name = "acctest-fleet-id-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_id = "/communityGalleries/${azurerm_shared_image_gallery.test.sharing.0.community_gallery.0.name}/images/${azurerm_shared_image_version.test.image_name}"
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_id = "/communityGalleries/${azurerm_shared_image_gallery.linux_test.sharing.0.community_gallery.0.name}/images/${azurerm_shared_image_version.linux_test.image_name}"
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ }
+ }
+ }
+}
+`, r.imageFromSourceImageReference(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) imageFromCommunitySharedImageGalleryVersion(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_image" "test" {
+ name = "test"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.source.id
+}
+
+resource "azurerm_shared_image_gallery" "test" {
+ name = "acctestsig%[2]d"
+ resource_group_name = "${azurerm_resource_group.test.name}"
+ location = "${azurerm_resource_group.test.location}"
+
+ sharing {
+ permission = "Community"
+ community_gallery {
+ eula = "https://eula.net"
+ prefix = "prefix"
+ publisher_email = "publisher@test.net"
+ publisher_uri = "https://publisher.net"
+ }
+ }
+}
+
+resource "azurerm_shared_image" "test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.test.name
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.test.gallery_name
+ image_name = azurerm_shared_image.test.name
+ resource_group_name = azurerm_shared_image.test.resource_group_name
+ location = azurerm_shared_image.test.location
+ managed_image_id = azurerm_image.test.id
+
+ target_region {
+ name = azurerm_shared_image.test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+
+resource "azurerm_image" "linux_test" {
+ name = "test"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ source_virtual_machine_id = azurerm_linux_virtual_machine.linux-test-source.id
+}
+
+resource "azurerm_shared_image_gallery" "linux_test" {
+ name = "acctestsiglinux%[2]d"
+ resource_group_name = "${azurerm_resource_group.linux_test.name}"
+ location = "${azurerm_resource_group.linux_test.location}"
+
+ sharing {
+ permission = "Community"
+ community_gallery {
+ eula = "https://eula.net"
+ prefix = "prefix"
+ publisher_email = "publisher@test.net"
+ publisher_uri = "https://publisher.net"
+ }
+ }
+}
+
+resource "azurerm_shared_image" "linux_test" {
+ name = "acctest-gallery-image"
+ gallery_name = azurerm_shared_image_gallery.linux_test.name
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ os_type = "Linux"
+
+ identifier {
+ publisher = "AcceptanceTest-Publisher"
+ offer = "AcceptanceTest-Offer"
+ sku = "AcceptanceTest-Sku"
+ }
+}
+
+resource "azurerm_shared_image_version" "linux_test" {
+ name = "0.0.1"
+ gallery_name = azurerm_shared_image.linux_test.gallery_name
+ image_name = azurerm_shared_image.linux_test.name
+ resource_group_name = azurerm_shared_image.linux_test.resource_group_name
+ location = azurerm_shared_image.linux_test.location
+ managed_image_id = azurerm_image.linux_test.id
+
+ target_region {
+ name = azurerm_shared_image.linux_test.location
+ regional_replica_count = "5"
+ storage_account_type = "Standard_LRS"
+ }
+}
+
+resource "azurerm_compute_fleet" "image_id" {
+ name = "acctest-fleet-id-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ regular_priority_profile {
+ capacity = 1
+ min_capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_id = "/communityGalleries/${azurerm_shared_image_gallery.test.sharing.0.community_gallery.0.name}/images/${azurerm_shared_image_version.test.image_name}/versions/${azurerm_shared_image_version.test.name}"
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_id = "/communityGalleries/${azurerm_shared_image_gallery.linux_test.sharing.0.community_gallery.0.name}/images/${azurerm_shared_image_version.linux_test.image_name}/versions/${azurerm_shared_image_version.linux_test.name}"
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = true
+ ip_configuration {
+ name = "ipConfigTest"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ }
+ }
+ }
+ }
+}
+`, r.imageFromSourceImageReference(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (ComputeFleetTestResource) generalizeVirtualMachine() func(context.Context, *clients.Client, *pluginsdk.InstanceState) error {
+ return func(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) error {
+ id, err := virtualmachines.ParseVirtualMachineID(state.ID)
+ if err != nil {
+ return err
+ }
+
+ if _, ok := ctx.Deadline(); !ok {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithTimeout(ctx, 15*time.Minute)
+ defer cancel()
+ }
+
+ // these are nested in a Set in the Legacy VM resource, simpler to compute them
+ userName := "testadmin1234"
+ password := "Password1234!"
+
+ // first retrieve the Virtual Machine, since we need to find
+ nicIdRaw := state.Attributes["network_interface_ids.0"]
+ nicId, err := commonids.ParseNetworkInterfaceID(nicIdRaw)
+ if err != nil {
+ return err
+ }
+
+ log.Printf("[DEBUG] Retrieving Network Interface..")
+ nic, err := client.Network.NetworkInterfaces.Get(ctx, *nicId, networkinterfaces.DefaultGetOperationOptions())
+ if err != nil {
+ return fmt.Errorf("retrieving %s: %+v", *nicId, err)
+ }
+
+ publicIpRaw := ""
+ if model := nic.Model; model != nil {
+ if props := model.Properties; props != nil {
+ if configs := props.IPConfigurations; configs != nil {
+ for _, config := range *props.IPConfigurations {
+ if configProps := config.Properties; configProps != nil {
+ if configProps.PublicIPAddress == nil {
+ continue
+ }
+
+ if configProps.PublicIPAddress.Id == nil {
+ continue
+ }
+
+ publicIpRaw = *configProps.PublicIPAddress.Id
+ break
+ }
+ }
+ }
+ }
+ }
+ if publicIpRaw == "" {
+ return fmt.Errorf("retrieving %s: could not determine Public IP Address ID", *nicId)
+ }
+
+ log.Printf("[DEBUG] Retrieving Public IP Address %q..", publicIpRaw)
+ publicIpId, err := commonids.ParsePublicIPAddressID(publicIpRaw)
+ if err != nil {
+ return err
+ }
+
+ publicIpAddress, err := client.Network.PublicIPAddresses.Get(ctx, *publicIpId, publicipaddresses.DefaultGetOperationOptions())
+ if err != nil {
+ return fmt.Errorf("retrieving %s: %+v", *publicIpId, err)
+ }
+ fqdn := ""
+
+ if model := publicIpAddress.Model; model != nil {
+ if props := model.Properties; props != nil {
+ if dns := props.DnsSettings; dns != nil {
+ if dns.Fqdn != nil {
+ fqdn = *dns.Fqdn
+ }
+ }
+ }
+ }
+ if fqdn == "" {
+ return fmt.Errorf("unable to determine FQDN for %q", *publicIpId)
+ }
+
+ log.Printf("[DEBUG] Running Generalization Command..")
+ sshGeneralizationCommand := ssh.Runner{
+ Hostname: fqdn,
+ Port: 22,
+ Username: userName,
+ Password: password,
+ CommandsToRun: []string{
+ ssh.LinuxAgentDeprovisionCommand,
+ },
+ }
+ if err := sshGeneralizationCommand.Run(ctx); err != nil {
+ return fmt.Errorf("Bad: running generalization command: %+v", err)
+ }
+
+ log.Printf("[DEBUG] Deallocating VM..")
+ if err := client.Compute.VirtualMachinesClient.DeallocateThenPoll(ctx, *id, virtualmachines.DefaultDeallocateOperationOptions()); err != nil {
+ return fmt.Errorf("Bad: deallocating %s: %+v", *id, err)
+ }
+
+ log.Printf("[DEBUG] Generalizing VM..")
+ if _, err = client.Compute.VirtualMachinesClient.Generalize(ctx, *id); err != nil {
+ return fmt.Errorf("Bad: Generalizing %s: %+v", *id, err)
+ }
+
+ return nil
+ }
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_network_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_network_test.go
new file mode 100644
index 000000000000..556b327386ad
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_network_test.go
@@ -0,0 +1,1265 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileNetwork_basic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.networkProfileBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileNetwork_completeForBaseVirtualMachineProfile(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.netWorkProfileCompleteForBaseVirtualMachineProfile(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileNetwork_completeForAdditionalLocation(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.netWorkProfileCompleteForAdditionalLocation(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileNetwork_updateForBaseVirtualMachineProfile(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.netWorkProfileCompleteForBaseVirtualMachineProfile(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.netWorkProfileCompleteForBaseVirtualMachineProfileUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ // Test with `networkProfileBasicWithZones` as `netWorkProfileComplete` test requires `zones`
+ Config: r.networkProfileBasicWithZones(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep("virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.netWorkProfileCompleteForBaseVirtualMachineProfile(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileNetwork_updateForAdditionalLocation(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.netWorkProfileCompleteForAdditionalLocation(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.netWorkProfileCompleteForAdditionalLocationUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.networkProfileBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.netWorkProfileCompleteForAdditionalLocation(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) networkProfileBasic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) networkProfileBasicWithZones(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 1
+ zones = ["1", "2"]
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+}
+`, r.template(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileCompleteForBaseVirtualMachineProfile(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ zones = ["1", "2"]
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+ accelerated_networking_enabled = true
+ ip_forwarding_enabled = true
+ auxiliary_mode = "AcceleratedConnections"
+ auxiliary_sku = "A2"
+ delete_option = "Delete"
+ network_security_group_id = azurerm_network_security_group.test.id
+ dns_servers = ["8.8.8.8", "8.8.4.4"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.test.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Delete"
+ domain_name_label = "test-domain-label"
+ domain_name_label_scope = "ResourceGroupReuse"
+ idle_timeout_in_minutes = 4
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.test.id
+ application_security_group_ids = [azurerm_application_security_group.test.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 15
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+}
+`, r.template(data), r.netWorkProfileBaseVirtualMachineProfileResourceDependencies(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileCompleteForAdditionalLocation(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+ accelerated_networking_enabled = true
+ ip_forwarding_enabled = true
+ auxiliary_mode = "AcceleratedConnections"
+ auxiliary_sku = "A2"
+ delete_option = "Delete"
+ network_security_group_id = azurerm_network_security_group.test.id
+ dns_servers = ["8.8.8.8", "8.8.4.4"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.test.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Delete"
+ domain_name_label = "test-domain-label"
+ domain_name_label_scope = "ResourceGroupReuse"
+ idle_timeout_in_minutes = 4
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.test.id
+ application_security_group_ids = [azurerm_application_security_group.test.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 15
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+
+ virtual_machine_profile_override {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = true
+ accelerated_networking_enabled = true
+ ip_forwarding_enabled = true
+ auxiliary_mode = "AcceleratedConnections"
+ auxiliary_sku = "A2"
+ delete_option = "Delete"
+ network_security_group_id = azurerm_network_security_group.linux_test.id
+ dns_servers = ["8.8.8.8", "8.8.4.4"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.linux_test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.linux_test.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Delete"
+ domain_name_label = "test-domain-label"
+ domain_name_label_scope = "ResourceGroupReuse"
+ idle_timeout_in_minutes = 4
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.linux_test.id
+ application_security_group_ids = [azurerm_application_security_group.linux_test.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 15
+ }
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), r.netWorkProfileAdditionalLocationResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileCompleteForBaseVirtualMachineProfileUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ zones = ["1", "2"]
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = false
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = false
+ delete_option = "Detach"
+ network_security_group_id = azurerm_network_security_group.other.id
+ dns_servers = ["8.8.8.8"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.test.id, azurerm_application_security_group.other.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Detach"
+ domain_name_label = "test-domain-label-update"
+ domain_name_label_scope = "SubscriptionReuse"
+ idle_timeout_in_minutes = 14
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.test.id
+ application_security_group_ids = [azurerm_application_security_group.test.id, azurerm_application_security_group.other.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 10
+ }
+ }
+ }
+
+ network_interface {
+ name = "nic-test-multiple"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+}
+`, r.template(data), r.netWorkProfileBaseVirtualMachineProfileResourceDependencies(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileCompleteForAdditionalLocationUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = false
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = false
+ delete_option = "Detach"
+ network_security_group_id = azurerm_network_security_group.other.id
+ dns_servers = ["8.8.8.8"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.test.id, azurerm_application_security_group.other.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Detach"
+ domain_name_label = "test-domain-label-update"
+ domain_name_label_scope = "SubscriptionReuse"
+ idle_timeout_in_minutes = 14
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.test.id
+ application_security_group_ids = [azurerm_application_security_group.test.id, azurerm_application_security_group.other.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 10
+ }
+ }
+ }
+
+ network_interface {
+ name = "nic-test-multiple"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+
+ virtual_machine_profile_override {
+ network_api_version = "2022-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "nic-test"
+ primary = false
+ accelerated_networking_enabled = false
+ ip_forwarding_enabled = false
+ delete_option = "Detach"
+ network_security_group_id = azurerm_network_security_group.linux_test_other.id
+ dns_servers = ["8.8.8.8"]
+ ip_configuration {
+ name = "first"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ application_gateway_backend_address_pool_ids = [tolist(azurerm_application_gateway.linux_test.backend_address_pool)[0].id]
+ application_security_group_ids = [azurerm_application_security_group.linux_test.id, azurerm_application_security_group.linux_test_other.id]
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ public_ip_address {
+ name = "nic-pip-first"
+ delete_option = "Detach"
+ domain_name_label = "test-domain-label-update"
+ domain_name_label_scope = "SubscriptionReuse"
+ idle_timeout_in_minutes = 14
+ sku_name = "Standard_Regional"
+ version = "IPv4"
+ ip_tag {
+ type = "RoutingPreference"
+ tag = "Internet"
+ }
+ }
+ version = "IPv4"
+ }
+
+ ip_configuration {
+ name = "second"
+ subnet_id = azurerm_subnet.linux_test.id
+ application_security_group_ids = [azurerm_application_security_group.linux_test.id, azurerm_application_security_group.linux_test_other.id]
+ public_ip_address {
+ name = "nic-pip-second"
+ idle_timeout_in_minutes = 10
+ }
+ }
+ }
+
+ network_interface {
+ name = "nic-test-multiple"
+ primary = true
+
+ ip_configuration {
+ name = "primary"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.linux_test.id]
+ }
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), r.netWorkProfileAdditionalLocationResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileAdditionalLocationResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+
+resource "azurerm_network_security_group" "test" {
+ name = "acceptanceTestSecurityGroup-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "test" {
+ location = azurerm_resource_group.test.location
+ name = "TestApplicationSecurityGroup"
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_network_security_group" "other" {
+ name = "acceptanceTestSecurityGroup-other-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "other" {
+ location = azurerm_resource_group.test.location
+ name = "TestApplicationSecurityGroupOther"
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_subnet" "gwtest" {
+ name = "gw-subnet-%[1]d"
+ resource_group_name = azurerm_resource_group.test.name
+ virtual_network_name = azurerm_virtual_network.test.name
+ address_prefixes = ["10.0.3.0/24"]
+}
+
+resource "azurerm_public_ip" "gwtest" {
+ name = "acctest-pubip-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ allocation_method = "Static"
+ sku = "Standard"
+}
+
+resource "azurerm_application_gateway" "test" {
+ name = "acctestgw-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ sku {
+ name = "Standard_v2"
+ tier = "Standard_v2"
+ capacity = 2
+ }
+
+ gateway_ip_configuration {
+ name = "gw-ip-config1"
+ subnet_id = azurerm_subnet.gwtest.id
+ }
+
+ frontend_ip_configuration {
+ name = "ip-config-public"
+ public_ip_address_id = azurerm_public_ip.gwtest.id
+ }
+
+ frontend_port {
+ name = "port-8080"
+ port = 8080
+ }
+
+ backend_address_pool {
+ name = "pool-1"
+ }
+
+ backend_http_settings {
+ name = "backend-http-1"
+ port = 8010
+ protocol = "Http"
+ cookie_based_affinity = "Enabled"
+ request_timeout = 30
+
+ probe_name = "probe-1"
+ }
+
+ http_listener {
+ name = "listener-1"
+ frontend_ip_configuration_name = "ip-config-public"
+ frontend_port_name = "port-8080"
+ protocol = "Http"
+ }
+
+ probe {
+ name = "probe-1"
+ protocol = "Http"
+ path = "/test"
+ host = "azure.com"
+ timeout = 120
+ interval = 300
+ unhealthy_threshold = 8
+ match {
+ status_code = ["200-399"]
+ }
+ }
+
+ request_routing_rule {
+ name = "rule-basic-1"
+ rule_type = "Basic"
+ http_listener_name = "listener-1"
+ backend_address_pool_name = "pool-1"
+ backend_http_settings_name = "backend-http-1"
+
+ priority = 10
+ }
+
+ tags = {
+ environment = "tf01"
+ }
+}
+
+resource "azurerm_network_security_group" "linux_test" {
+ name = "acceptanceTestSecurityGroup-%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "linux_test" {
+ location = azurerm_resource_group.linux_test.location
+ name = "TestApplicationSecurityGroup"
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_network_security_group" "linux_test_other" {
+ name = "acceptanceTestSecurityGroup-other-%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "linux_test_other" {
+ location = azurerm_resource_group.linux_test.location
+ name = "TestApplicationSecurityGroupOther"
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_subnet" "linux_test_gwtest" {
+ name = "gw-subnet-%[1]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ virtual_network_name = azurerm_virtual_network.linux_test.name
+ address_prefixes = ["10.0.3.0/24"]
+}
+
+resource "azurerm_public_ip" "linux_test_gwtest" {
+ name = "acctest-pubip-%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+}
+
+resource "azurerm_application_gateway" "linux_test" {
+ name = "acctestgw-%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+
+ sku {
+ name = "Standard_v2"
+ tier = "Standard_v2"
+ capacity = 2
+ }
+
+ gateway_ip_configuration {
+ name = "gw-ip-config1"
+ subnet_id = azurerm_subnet.linux_test_gwtest.id
+ }
+
+ frontend_ip_configuration {
+ name = "ip-config-public"
+ public_ip_address_id = azurerm_public_ip.linux_test_gwtest.id
+ }
+
+ frontend_port {
+ name = "port-8080"
+ port = 8080
+ }
+
+ backend_address_pool {
+ name = "pool-1"
+ }
+
+ backend_http_settings {
+ name = "backend-http-1"
+ port = 8010
+ protocol = "Http"
+ cookie_based_affinity = "Enabled"
+ request_timeout = 30
+
+ probe_name = "probe-1"
+ }
+
+ http_listener {
+ name = "listener-1"
+ frontend_ip_configuration_name = "ip-config-public"
+ frontend_port_name = "port-8080"
+ protocol = "Http"
+ }
+
+ probe {
+ name = "probe-1"
+ protocol = "Http"
+ path = "/test"
+ host = "azure.com"
+ timeout = 120
+ interval = 300
+ unhealthy_threshold = 8
+ match {
+ status_code = ["200-399"]
+ }
+ }
+
+ request_routing_rule {
+ name = "rule-basic-1"
+ rule_type = "Basic"
+ http_listener_name = "listener-1"
+ backend_address_pool_name = "pool-1"
+ backend_http_settings_name = "backend-http-1"
+
+ priority = 10
+ }
+
+ tags = {
+ environment = "tf01"
+ }
+}
+`, data.RandomInteger)
+}
+
+func (r ComputeFleetTestResource) netWorkProfileBaseVirtualMachineProfileResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+
+resource "azurerm_network_security_group" "test" {
+ name = "acceptanceTestSecurityGroup-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "test" {
+ location = azurerm_resource_group.test.location
+ name = "TestApplicationSecurityGroup"
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_network_security_group" "other" {
+ name = "acceptanceTestSecurityGroup-other-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_application_security_group" "other" {
+ location = azurerm_resource_group.test.location
+ name = "TestApplicationSecurityGroupOther"
+ resource_group_name = azurerm_resource_group.test.name
+
+ lifecycle {
+ create_before_destroy = true
+ }
+}
+
+resource "azurerm_subnet" "gwtest" {
+ name = "gw-subnet-%[1]d"
+ resource_group_name = azurerm_resource_group.test.name
+ virtual_network_name = azurerm_virtual_network.test.name
+ address_prefixes = ["10.0.3.0/24"]
+}
+
+resource "azurerm_public_ip" "gwtest" {
+ name = "acctest-pubip-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ allocation_method = "Static"
+ sku = "Standard"
+}
+
+resource "azurerm_application_gateway" "test" {
+ name = "acctestgw-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+
+ sku {
+ name = "Standard_v2"
+ tier = "Standard_v2"
+ capacity = 2
+ }
+
+ gateway_ip_configuration {
+ name = "gw-ip-config1"
+ subnet_id = azurerm_subnet.gwtest.id
+ }
+
+ frontend_ip_configuration {
+ name = "ip-config-public"
+ public_ip_address_id = azurerm_public_ip.gwtest.id
+ }
+
+ frontend_port {
+ name = "port-8080"
+ port = 8080
+ }
+
+ backend_address_pool {
+ name = "pool-1"
+ }
+
+ backend_http_settings {
+ name = "backend-http-1"
+ port = 8010
+ protocol = "Http"
+ cookie_based_affinity = "Enabled"
+ request_timeout = 30
+
+ probe_name = "probe-1"
+ }
+
+ http_listener {
+ name = "listener-1"
+ frontend_ip_configuration_name = "ip-config-public"
+ frontend_port_name = "port-8080"
+ protocol = "Http"
+ }
+
+ probe {
+ name = "probe-1"
+ protocol = "Http"
+ path = "/test"
+ host = "azure.com"
+ timeout = 120
+ interval = 300
+ unhealthy_threshold = 8
+ match {
+ status_code = ["200-399"]
+ }
+ }
+
+ request_routing_rule {
+ name = "rule-basic-1"
+ rule_type = "Basic"
+ http_listener_name = "listener-1"
+ backend_address_pool_name = "pool-1"
+ backend_http_settings_name = "backend-http-1"
+
+ priority = 10
+ }
+
+ tags = {
+ environment = "tf01"
+ }
+}
+`, data.RandomInteger)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_disk_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_disk_test.go
new file mode 100644
index 000000000000..dd23dcce1420
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_disk_test.go
@@ -0,0 +1,759 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileOsDisk_basic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osDiskBasic(data, data.Locations.Primary, data.Locations.Secondary, "Standard_D1_v2"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsDisk_complete(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ // HardCode location is due to the limitation that VM size could be supported in two regions at the same time
+ Config: r.osDiskComplete(data, "westeurope", "centralus"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsDisk_update(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osDiskComplete(data, "westeurope", "centralus"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ // Limited regional availability for some storage account type
+ Config: r.osDiskCompleteUpdate(data, "westeurope", "centralus"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.osDiskBasic(data, "westeurope", "centralus", "Standard_F2s_v2"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.osDiskComplete(data, "westeurope", "centralus"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) osDiskBasic(data acceptance.TestData, primaryLocation string, secondaryLocation string, vmSize string) string {
+ return fmt.Sprintf(`
+
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "%[5]s"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {}
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {}
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ }
+ }
+}
+`, r.osDiskTemplate(data, primaryLocation, secondaryLocation), data.RandomInteger, primaryLocation, secondaryLocation, vmSize)
+}
+
+func (r ComputeFleetTestResource) osDiskComplete(data acceptance.TestData, primaryLocation string, secondaryLocation string) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DC8eds_v5"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ diff_disk_option = "Local"
+ diff_disk_placement = "ResourceDisk"
+ disk_size_in_gb = 30
+ storage_account_type = "Premium_LRS"
+ security_encryption_type = "DiskWithVMGuestState"
+ disk_encryption_set_id = azurerm_disk_encryption_set.test.id
+ write_accelerator_enabled = false
+ }
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-confidential-vm-jammy"
+ sku = "22_04-lts-cvm"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ diff_disk_option = "Local"
+ diff_disk_placement = "ResourceDisk"
+ disk_size_in_gb = 30
+ storage_account_type = "Premium_LRS"
+ security_encryption_type = "DiskWithVMGuestState"
+ disk_encryption_set_id = azurerm_disk_encryption_set.linux_test.id
+ write_accelerator_enabled = false
+ }
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-confidential-vm-jammy"
+ sku = "22_04-lts-cvm"
+ version = "latest"
+ }
+ }
+ }
+
+ depends_on = [
+ "azurerm_role_assignment.disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.disk-encryption",
+ "azurerm_role_assignment.linux-test-disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.linux-test-disk-encryption"
+ ]
+}
+`, r.osDiskDiskEncryptionSetResourceDependencies(data), r.osDiskTemplateWithOutProvider(data, primaryLocation, secondaryLocation), data.RandomInteger, primaryLocation, secondaryLocation)
+}
+
+func (r ComputeFleetTestResource) osDiskCompleteUpdate(data acceptance.TestData, primaryLocation string, secondaryLocation string) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+ platform_fault_domain_count = 1
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 0
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DC8eds_v5"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ diff_disk_option = "Local"
+ diff_disk_placement = "ResourceDisk"
+ disk_size_in_gb = 50
+ storage_account_type = "Premium_ZRS"
+ security_encryption_type = "DiskWithVMGuestState"
+ disk_encryption_set_id = azurerm_disk_encryption_set.test.id
+ write_accelerator_enabled = false
+ }
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-confidential-vm-focal"
+ sku = "20_04-lts-cvm"
+ version = "latest"
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.linux_test.id
+
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ os_disk {
+ caching = "ReadOnly"
+ delete_option = "Delete"
+ diff_disk_option = "Local"
+ diff_disk_placement = "ResourceDisk"
+ disk_size_in_gb = 50
+ storage_account_type = "Premium_ZRS"
+ security_encryption_type = "DiskWithVMGuestState"
+ disk_encryption_set_id = azurerm_disk_encryption_set.linux_test.id
+ write_accelerator_enabled = false
+ }
+
+ source_image_reference {
+ publisher = "canonical"
+ offer = "0001-com-ubuntu-confidential-vm-focal"
+ sku = "20_04-lts-cvm"
+ version = "latest"
+ }
+ }
+ }
+
+ depends_on = [
+ "azurerm_role_assignment.disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.disk-encryption",
+ "azurerm_role_assignment.linux-test-disk-encryption-read-keyvault",
+ "azurerm_key_vault_access_policy.linux-test-disk-encryption"
+ ]
+}
+`, r.osDiskDiskEncryptionSetResourceDependencies(data), r.osDiskTemplateWithOutProvider(data, primaryLocation, secondaryLocation), data.RandomInteger, primaryLocation, secondaryLocation)
+}
+
+func (r ComputeFleetTestResource) osDiskTemplate(data acceptance.TestData, primaryLocation string, secondaryLocation string) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {}
+}
+
+%[1]s
+
+`, r.osDiskTemplateWithOutProvider(data, primaryLocation, secondaryLocation), data.RandomInteger, primaryLocation, secondaryLocation)
+}
+
+func (r ComputeFleetTestResource) osDiskTemplateWithOutProvider(data acceptance.TestData, primaryLocation string, secondaryLocation string) string {
+ return fmt.Sprintf(`
+locals {
+ first_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
+ second_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/NDMj2wG6bSa6jbn6E3LYlUsYiWMp1CQ2sGAijPALW6OrSu30lz7nKpoh8Qdw7/A4nAJgweI5Oiiw5/BOaGENM70Go+VM8LQMSxJ4S7/8MIJEZQp5HcJZ7XDTcEwruknrd8mllEfGyFzPvJOx6QAQocFhXBW6+AlhM3gn/dvV5vdrO8ihjET2GoDUqXPYC57ZuY+/Fz6W3KV8V97BvNUhpY5yQrP5VpnyvvXNFQtzDfClTvZFPuoHQi3/KYPi6O0FSD74vo8JOBZZY09boInPejkm9fvHQqfh0bnN7B6XJoUwC1Qprrx+XIy7ust5AEn5XL7d4lOvcR14MxDDKEp you@me.com"
+ first_ed25519_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDqzSi9IHoYnbE3YQ+B2fQEVT8iGFemyPovpEtPziIVB you@me.com"
+ second_ed25519_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDqzSi9IHoYnbE3YQ+B2fQEVT8iGFemyPovpEtPziIVB hello@world.com"
+ admin_username = "testadmin1234"
+ admin_password = "Password1234!"
+ admin_password_update = "Password1234!Update"
+}
+
+resource "azurerm_resource_group" "test" {
+ name = "acctest-rg-fleet-%[1]d"
+ location = "%[2]s"
+}
+
+resource "azurerm_virtual_network" "test" {
+ name = "acctvn-%[1]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+}
+
+resource "azurerm_subnet" "test" {
+ name = "acctsub-%[1]d"
+ resource_group_name = azurerm_resource_group.test.name
+ virtual_network_name = azurerm_virtual_network.test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "test" {
+ name = "acctestpublicIP-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "test" {
+ name = "acctest-loadbalancer-%[1]d"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "test" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.test.id
+}
+
+
+resource "azurerm_resource_group" "linux_test" {
+ name = "acctest-rg-fleet-al-%[1]d"
+ location = "%[3]s"
+}
+
+resource "azurerm_virtual_network" "linux_test" {
+ name = "acctvn-al-%[1]d"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+}
+
+resource "azurerm_subnet" "linux_test" {
+ name = "acctsub-%[1]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ virtual_network_name = azurerm_virtual_network.linux_test.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "linux_test" {
+ name = "acctestpublicIP%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "linux_test" {
+ name = "acctest-loadbalancer-%[1]d"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.linux_test.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "linux_test" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.linux_test.id
+}
+
+`, data.RandomInteger, primaryLocation, secondaryLocation)
+}
+
+func (r ComputeFleetTestResource) osDiskDiskEncryptionSetResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_keys_on_destroy = false
+ }
+ }
+}
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkv%[1]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ purge_protection_enabled = true
+ enabled_for_disk_encryption = true
+}
+
+resource "azurerm_key_vault_access_policy" "service-principal" {
+ key_vault_id = azurerm_key_vault.test.id
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ key_permissions = [
+ "Create",
+ "Delete",
+ "Recover",
+ "Get",
+ "Purge",
+ "Update",
+ "GetRotationPolicy",
+ ]
+
+ secret_permissions = [
+ "Get",
+ "Delete",
+ "Set",
+ ]
+}
+
+resource "azurerm_key_vault_key" "test" {
+ name = "examplekey"
+ key_vault_id = azurerm_key_vault.test.id
+ key_type = "RSA"
+ key_size = 2048
+
+ key_opts = [
+ "decrypt",
+ "encrypt",
+ "sign",
+ "unwrapKey",
+ "verify",
+ "wrapKey",
+ ]
+
+ depends_on = ["azurerm_key_vault_access_policy.service-principal"]
+}
+
+resource "azurerm_disk_encryption_set" "test" {
+ name = "acctestdes-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ key_vault_key_id = azurerm_key_vault_key.test.id
+
+ identity {
+ type = "SystemAssigned"
+ }
+}
+
+resource "azurerm_key_vault_access_policy" "disk-encryption" {
+ key_vault_id = azurerm_key_vault.test.id
+
+ key_permissions = [
+ "Get",
+ "WrapKey",
+ "UnwrapKey",
+ "GetRotationPolicy",
+ ]
+
+ tenant_id = azurerm_disk_encryption_set.test.identity.0.tenant_id
+ object_id = azurerm_disk_encryption_set.test.identity.0.principal_id
+}
+
+resource "azurerm_role_assignment" "disk-encryption-read-keyvault" {
+ scope = azurerm_key_vault.test.id
+ role_definition_name = "Reader"
+ principal_id = azurerm_disk_encryption_set.test.identity.0.principal_id
+}
+
+resource "azurerm_key_vault" "linux_test" {
+ name = "acctestkvlinux%[1]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ sku_name = "standard"
+ purge_protection_enabled = true
+ enabled_for_disk_encryption = true
+}
+
+resource "azurerm_key_vault_access_policy" "linux-test-service-principal" {
+ key_vault_id = azurerm_key_vault.linux_test.id
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ key_permissions = [
+ "Create",
+ "Delete",
+ "Recover",
+ "Get",
+ "Purge",
+ "Update",
+ "GetRotationPolicy",
+ ]
+
+ secret_permissions = [
+ "Get",
+ "Delete",
+ "Set",
+ ]
+}
+
+resource "azurerm_key_vault_key" "linux_test" {
+ name = "examplekey"
+ key_vault_id = azurerm_key_vault.linux_test.id
+ key_type = "RSA"
+ key_size = 2048
+
+ key_opts = [
+ "decrypt",
+ "encrypt",
+ "sign",
+ "unwrapKey",
+ "verify",
+ "wrapKey",
+ ]
+
+ depends_on = ["azurerm_key_vault_access_policy.linux-test-service-principal"]
+}
+
+resource "azurerm_disk_encryption_set" "linux_test" {
+ name = "acctestdes-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ key_vault_key_id = azurerm_key_vault_key.linux_test.id
+
+ identity {
+ type = "SystemAssigned"
+ }
+}
+
+resource "azurerm_key_vault_access_policy" "linux-test-disk-encryption" {
+ key_vault_id = azurerm_key_vault.linux_test.id
+
+ key_permissions = [
+ "Get",
+ "WrapKey",
+ "UnwrapKey",
+ "GetRotationPolicy",
+ ]
+
+ tenant_id = azurerm_disk_encryption_set.linux_test.identity.0.tenant_id
+ object_id = azurerm_disk_encryption_set.linux_test.identity.0.principal_id
+}
+
+resource "azurerm_role_assignment" "linux-test-disk-encryption-read-keyvault" {
+ scope = azurerm_key_vault.linux_test.id
+ role_definition_name = "Reader"
+ principal_id = azurerm_disk_encryption_set.linux_test.identity.0.principal_id
+}
+`, data.RandomString, data.RandomInteger)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_profile_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_profile_test.go
new file mode 100644
index 000000000000..cddeff755088
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_os_profile_test.go
@@ -0,0 +1,1534 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_linuxBasic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileLinuxBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_linuxComplete(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileLinuxComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_linuxUpdate(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileLinuxComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64"),
+ {
+ Config: r.osProfileLinuxCompleteUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64"),
+ {
+ Config: r.osProfileLinuxBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.osProfileLinuxComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_windowsBasic(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileWindowsBasic(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_windowsComplete(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileWindowsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOsProfile_windowsUpdate(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.osProfileWindowsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content"),
+ {
+ Config: r.osProfileWindowsCompleteUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content"),
+ {
+ Config: r.osProfileWindowsComplete(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "virtual_machine_profile.0.os_profile.0.custom_data_base64",
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.additional_unattend_content.0.content"),
+ })
+}
+
+func (r ComputeFleetTestResource) osProfileWindowsBasic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_deleted_certificates_on_destroy = false
+ }
+ }
+}
+
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ compute_api_version = "2024-03-01"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ %[4]s
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.windows_test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, r.basicBaseWindowsVirtualMachineProfile(), data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) osProfileWindowsComplete(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2022-datacenter-azure-edition-core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ additional_unattend_content {
+ setting = "FirstLogonCommands"
+ content = "shutdown /r /t 0 /c \"initial reboot\"reboot1"
+ }
+ automatic_updates_enabled = true
+ vm_agent_platform_updates_enabled = true
+
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ hot_patching_enabled = true
+ bypass_platform_safety_checks_enabled = false
+ reboot_setting = "Always"
+ provision_vm_agent_enabled = true
+ secret {
+ key_vault_id = azurerm_key_vault.test.id
+ certificate {
+ url = azurerm_key_vault_certificate.first.secret_id
+ store = "My"
+ }
+ }
+
+ time_zone = "W. Europe Standard Time"
+
+ winrm_listener {
+ certificate_url = azurerm_key_vault_certificate.first.secret_id
+ protocol = "Https"
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthWindows"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2022-datacenter-azure-edition-core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ additional_unattend_content {
+ setting = "FirstLogonCommands"
+ content = "shutdown /r /t 0 /c \"initial reboot\"reboot1"
+ }
+ automatic_updates_enabled = true
+ vm_agent_platform_updates_enabled = true
+
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ hot_patching_enabled = true
+ bypass_platform_safety_checks_enabled = false
+ reboot_setting = "Always"
+ provision_vm_agent_enabled = true
+ secret {
+ key_vault_id = azurerm_key_vault.windows_test.id
+ certificate {
+ url = azurerm_key_vault_certificate.windows_test_first.secret_id
+ store = "My"
+ }
+ }
+
+ time_zone = "W. Europe Standard Time"
+
+ winrm_listener {
+ certificate_url = azurerm_key_vault_certificate.windows_test_first.secret_id
+ protocol = "Https"
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthWindows"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.windows_test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplateWithOutProvider(data), r.secretWindowsResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) osProfileWindowsCompleteUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2022-datacenter-azure-edition-core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+
+ additional_unattend_content {
+ setting = "AutoLogon"
+ content = "${local.admin_username}WORKGROUP${local.admin_password}truetrue"
+ }
+ automatic_updates_enabled = false
+ vm_agent_platform_updates_enabled = false
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ hot_patching_enabled = true
+ provision_vm_agent_enabled = true
+ time_zone = "W. Europe Standard Time"
+ secret {
+ key_vault_id = azurerm_key_vault.test.id
+ certificate {
+ url = azurerm_key_vault_certificate.first.secret_id
+ store = "Root"
+ }
+ certificate {
+ url = azurerm_key_vault_certificate.second.secret_id
+ store = "Root"
+ }
+ }
+
+ winrm_listener {
+ certificate_url = azurerm_key_vault_certificate.first.secret_id
+ protocol = "Https"
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthWindows"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2022-datacenter-azure-edition-core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ additional_unattend_content {
+ setting = "AutoLogon"
+ content = "${local.admin_username}WORKGROUP${local.admin_password}truetrue"
+ }
+ automatic_updates_enabled = false
+ vm_agent_platform_updates_enabled = false
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ hot_patching_enabled = true
+ provision_vm_agent_enabled = true
+ time_zone = "W. Europe Standard Time"
+ secret {
+ key_vault_id = azurerm_key_vault.windows_test.id
+ certificate {
+ url = azurerm_key_vault_certificate.windows_test_first.secret_id
+ store = "Root"
+ }
+ certificate {
+ url = azurerm_key_vault_certificate.windows_test_second.secret_id
+ store = "Root"
+ }
+ }
+ winrm_listener {
+ certificate_url = azurerm_key_vault_certificate.windows_test_first.secret_id
+ protocol = "Https"
+ }
+
+
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthWindows"
+ type_handler_version = "1.0"
+ auto_upgrade_minor_version_enabled = true
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ primary = true
+ subnet_id = azurerm_subnet.windows_test.id
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplateWithOutProvider(data), r.secretWindowsResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) osProfileLinuxBasic(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_deleted_certificates_on_destroy = false
+ }
+ }
+}
+
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ compute_api_version = "2024-03-01"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ %[4]s
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), data.RandomInteger, data.Locations.Primary, r.basicBaseLinuxVirtualMachineProfile(), data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) osProfileLinuxComplete(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ custom_data_base64 = "Y3VzdG9tIGRhdGEh"
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ admin_ssh_keys = [local.first_public_key]
+ provision_vm_agent_enabled = true
+ vm_agent_platform_updates_enabled = true
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ bypass_platform_safety_checks_enabled = true
+ reboot_setting = "Always"
+ secret {
+ key_vault_id = azurerm_key_vault.test.id
+ certificate {
+ url = azurerm_key_vault_certificate.first.secret_id
+ }
+ }
+ }
+ }
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ custom_data_base64 = "Y3VzdG9tIGRhdGEh"
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ admin_ssh_keys = [local.first_public_key]
+ provision_vm_agent_enabled = true
+ vm_agent_platform_updates_enabled = true
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ bypass_platform_safety_checks_enabled = true
+ reboot_setting = "Always"
+ secret {
+ key_vault_id = azurerm_key_vault.linux_test.id
+ certificate {
+ url = azurerm_key_vault_certificate.linux_test_first.secret_id
+ }
+ }
+ }
+ }
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), r.secretLinuxResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) osProfileLinuxCompleteUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+%[2]s
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[3]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[4]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ custom_data_base64 = "Y3VzdG9tIGRhdGEh"
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ provision_vm_agent_enabled = true
+ vm_agent_platform_updates_enabled = false
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ secret {
+ key_vault_id = azurerm_key_vault.test.id
+ certificate {
+ url = azurerm_key_vault_certificate.first.secret_id
+ }
+ certificate {
+ url = azurerm_key_vault_certificate.second.secret_id
+ }
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ offer = "0001-com-ubuntu-server-focal"
+ publisher = "canonical"
+ sku = "20_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ custom_data_base64 = "Y3VzdG9tIGRhdGEh"
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = false
+ admin_ssh_keys = [local.first_public_key]
+ provision_vm_agent_enabled = true
+ vm_agent_platform_updates_enabled = false
+ patch_mode = "AutomaticByPlatform"
+ patch_assessment_mode = "ImageDefault"
+ secret {
+ key_vault_id = azurerm_key_vault.linux_test.id
+ certificate {
+ url = azurerm_key_vault_certificate.linux_test_first.secret_id
+ }
+ certificate {
+ url = azurerm_key_vault_certificate.linux_test_second.secret_id
+ }
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplateWithOutProvider(data), r.secretLinuxResourceDependencies(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) secretLinuxResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_certificates_on_destroy = false
+ }
+ }
+}
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkeyvault%[1]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+
+ sku_name = "standard"
+ enabled_for_template_deployment = true
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ certificate_permissions = [
+ "Create",
+ "Delete",
+ "Get",
+ "Update",
+ ]
+
+ key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"]
+
+ secret_permissions = [
+ "Set",
+ ]
+
+ storage_permissions = [
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_certificate" "first" {
+ name = "first"
+ key_vault_id = azurerm_key_vault.test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-first"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault_certificate" "second" {
+ name = "second"
+ key_vault_id = azurerm_key_vault.test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-second"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault" "linux_test" {
+ name = "acctestkvlinux%[1]s"
+ location = azurerm_resource_group.linux_test.location
+ resource_group_name = azurerm_resource_group.linux_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+
+ sku_name = "standard"
+ enabled_for_template_deployment = true
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ certificate_permissions = [
+ "Create",
+ "Delete",
+ "Get",
+ "Update",
+ ]
+
+ key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"]
+
+ secret_permissions = [
+ "Set",
+ ]
+
+ storage_permissions = [
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_certificate" "linux_test_first" {
+ name = "first"
+ key_vault_id = azurerm_key_vault.linux_test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-first"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault_certificate" "linux_test_second" {
+ name = "second"
+ key_vault_id = azurerm_key_vault.linux_test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-second"
+ validity_in_months = 12
+ }
+ }
+}
+`, data.RandomString)
+}
+
+func (r ComputeFleetTestResource) secretWindowsResourceDependencies(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+provider "azurerm" {
+ features {
+ key_vault {
+ purge_soft_delete_on_destroy = false
+ purge_soft_deleted_certificates_on_destroy = false
+ }
+ }
+}
+
+data "azurerm_client_config" "current" {}
+
+resource "azurerm_key_vault" "test" {
+ name = "acctestkeyvault%[1]s"
+ location = azurerm_resource_group.test.location
+ resource_group_name = azurerm_resource_group.test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+
+ sku_name = "standard"
+ enabled_for_template_deployment = true
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ certificate_permissions = [
+ "Create",
+ "Delete",
+ "Get",
+ "Update",
+ ]
+
+ key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"]
+
+ secret_permissions = [
+ "Set",
+ ]
+
+ storage_permissions = [
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_certificate" "first" {
+ name = "first"
+ key_vault_id = azurerm_key_vault.test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-first"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault_certificate" "second" {
+ name = "second"
+ key_vault_id = azurerm_key_vault.test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-second"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault" "windows_test" {
+ name = "acctestkvwin%[1]s"
+ location = azurerm_resource_group.windows_test.location
+ resource_group_name = azurerm_resource_group.windows_test.name
+ tenant_id = data.azurerm_client_config.current.tenant_id
+
+ sku_name = "standard"
+ enabled_for_template_deployment = true
+ enabled_for_deployment = true
+
+ access_policy {
+ tenant_id = data.azurerm_client_config.current.tenant_id
+ object_id = data.azurerm_client_config.current.object_id
+
+ certificate_permissions = [
+ "Create",
+ "Delete",
+ "Get",
+ "Update",
+ ]
+
+ key_permissions = ["Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy"]
+
+ secret_permissions = [
+ "Set",
+ ]
+
+ storage_permissions = [
+ "Set",
+ ]
+ }
+}
+
+resource "azurerm_key_vault_certificate" "windows_test_first" {
+ name = "firstwin"
+ key_vault_id = azurerm_key_vault.windows_test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-firstwin"
+ validity_in_months = 12
+ }
+ }
+}
+
+resource "azurerm_key_vault_certificate" "windows_test_second" {
+ name = "secondwin"
+ key_vault_id = azurerm_key_vault.windows_test.id
+
+ certificate_policy {
+ issuer_parameters {
+ name = "Self"
+ }
+
+ key_properties {
+ exportable = true
+ key_size = 2048
+ key_type = "RSA"
+ reuse_key = true
+ }
+
+ lifetime_action {
+ action {
+ action_type = "AutoRenew"
+ }
+
+ trigger {
+ days_before_expiry = 30
+ }
+ }
+
+ secret_properties {
+ content_type = "application/x-pkcs12"
+ }
+
+ x509_certificate_properties {
+ key_usage = [
+ "cRLSign",
+ "dataEncipherment",
+ "digitalSignature",
+ "keyAgreement",
+ "keyCertSign",
+ "keyEncipherment",
+ ]
+
+ subject = "CN=hello-world-secondwin"
+ validity_in_months = 12
+ }
+ }
+}
+`, data.RandomString)
+}
diff --git a/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_others_test.go b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_others_test.go
new file mode 100644
index 000000000000..9eb3453fe4f8
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_resource_virtual_machine_profile_others_test.go
@@ -0,0 +1,1832 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
+)
+
+func TestAccComputeFleet_virtualMachineProfileOthers_bootDiagnosticEnabled(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.bootDiagnostic(data, true),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.bootDiagnostic(data, false),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_capacityReservationGroup(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.capacityReservationGroup(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.capacityReservationGroupUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_galleryApplication(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.galleryApplication(data, "test"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.galleryApplication(data, "testUpdate"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_licenseType(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.licenseType(data, "Windows_Client"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password"),
+ {
+ Config: r.licenseType(data, "Windows_Server"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_scheduledEvent(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.scheduledEvent(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.scheduledEventUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_securityProfile(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.securityProfile(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.securityProfileUpdate(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_UserData(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.userData(data, "Hello World"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ {
+ Config: r.userData(data, "Goodbye World"),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_additionalCapabilitiesUltraSSD(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.additionalCapabilitiesUltraSSD(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func TestAccComputeFleet_virtualMachineProfileOthers_additionalCapabilitiesHibernation(t *testing.T) {
+ data := acceptance.BuildTestData(t, "azurerm_compute_fleet", "test")
+ r := ComputeFleetTestResource{}
+
+ data.ResourceTest(t, r, []acceptance.TestStep{
+ {
+ Config: r.additionalCapabilitiesHibernation(data),
+ Check: acceptance.ComposeTestCheckFunc(
+ check.That(data.ResourceName).ExistsInAzure(r),
+ ),
+ },
+ data.ImportStep(
+ "virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password",
+ "additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password"),
+ })
+}
+
+func (r ComputeFleetTestResource) bootDiagnostic(data acceptance.TestData, enabled bool) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ boot_diagnostic_enabled = %[4]t
+ boot_diagnostic_storage_account_endpoint = azurerm_storage_account.test.primary_blob_endpoint
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[6]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ boot_diagnostic_enabled = %[4]t
+ boot_diagnostic_storage_account_endpoint = azurerm_storage_account.linux_test.primary_blob_endpoint
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+
+resource "azurerm_storage_account" "test" {
+ name = "accteststr%[5]s"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ account_tier = "Standard"
+ account_replication_type = "LRS"
+ allow_nested_items_to_be_public = false
+}
+
+resource "azurerm_storage_account" "linux_test" {
+ name = "accteststrlinux%[5]s"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ account_tier = "Standard"
+ account_replication_type = "LRS"
+ allow_nested_items_to_be_public = false
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, enabled, data.RandomString, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) capacityReservationGroup(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_capacity_reservation_group" "test" {
+ name = "acctest-ccrg-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ zones = ["1", "2", "3"]
+}
+
+resource "azurerm_capacity_reservation" "test" {
+ name = "acctest-ccr-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.test.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_capacity_reservation_group" "linux_test" {
+ name = "acctest-ccrg-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ zones = ["1", "2", "3"]
+}
+
+resource "azurerm_capacity_reservation" "linux_test" {
+ name = "acctest-ccr-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.linux_test.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_F2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.test.id
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.linux_test.id
+
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ }
+ }
+ depends_on = [azurerm_capacity_reservation.test, azurerm_capacity_reservation.linux_test]
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) capacityReservationGroupUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_capacity_reservation_group" "test" {
+ name = "acctest-ccrg-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ zones = ["1", "2", "3"]
+
+}
+
+resource "azurerm_capacity_reservation" "test" {
+ name = "acctest-ccr-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.test.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_capacity_reservation_group" "test2" {
+ name = "acctest-ccrg2-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ zones = ["1", "2", "3"]
+}
+
+resource "azurerm_capacity_reservation" "test2" {
+ name = "acctest-ccr2-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.test2.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_capacity_reservation_group" "linux_test" {
+ name = "acctest-ccrg-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ zones = ["1", "2", "3"]
+}
+
+resource "azurerm_capacity_reservation" "linux_test" {
+ name = "acctest-ccr-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.linux_test.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_capacity_reservation_group" "linux_test2" {
+ name = "acctest-ccrg2-%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ zones = ["1", "2", "3"]
+}
+
+resource "azurerm_capacity_reservation" "linux_test2" {
+ name = "acctest-ccr2-%[2]d"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.linux_test2.id
+ sku {
+ name = "Standard_F2"
+ capacity = 2
+ }
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_F2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.test2.id
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ capacity_reservation_group_id = azurerm_capacity_reservation_group.linux_test2.id
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+ depends_on = [azurerm_capacity_reservation.test2, azurerm_capacity_reservation.linux_test2]
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) galleryApplication(data acceptance.TestData, tag string) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_storage_account" "test" {
+ name = "accteststr%[4]s"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+ account_tier = "Standard"
+ account_replication_type = "LRS"
+}
+
+resource "azurerm_storage_container" "test" {
+ name = "test"
+ storage_account_name = azurerm_storage_account.test.name
+ container_access_type = "blob"
+}
+
+resource "azurerm_storage_blob" "test" {
+ name = "script"
+ storage_account_name = azurerm_storage_account.test.name
+ storage_container_name = azurerm_storage_container.test.name
+ type = "Page"
+ size = 512
+}
+
+resource "azurerm_storage_blob" "test2" {
+ name = "script2"
+ storage_account_name = azurerm_storage_account.test.name
+ storage_container_name = azurerm_storage_container.test.name
+ type = "Page"
+ size = 512
+}
+
+resource "azurerm_shared_image_gallery" "test" {
+ name = "acctestsig%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = azurerm_resource_group.test.location
+}
+
+resource "azurerm_gallery_application" "test" {
+ name = "acctest-app-%[2]d"
+ gallery_id = azurerm_shared_image_gallery.test.id
+ location = azurerm_shared_image_gallery.test.location
+ supported_os_type = "Linux"
+}
+
+resource "azurerm_gallery_application_version" "test" {
+ name = "0.0.1"
+ gallery_application_id = azurerm_gallery_application.test.id
+ location = azurerm_gallery_application.test.location
+
+ source {
+ media_link = azurerm_storage_blob.test.id
+ default_configuration_link = azurerm_storage_blob.test.id
+ }
+
+ manage_action {
+ install = "[install command]"
+ remove = "[remove command]"
+ }
+
+ target_region {
+ name = azurerm_gallery_application.test.location
+ regional_replica_count = 1
+ storage_account_type = "Premium_LRS"
+ }
+}
+
+
+resource "azurerm_storage_account" "linux_test" {
+ name = "accteststrlinux%[4]s"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+ account_tier = "Standard"
+ account_replication_type = "LRS"
+}
+
+resource "azurerm_storage_container" "linux_test" {
+ name = "testlinux"
+ storage_account_name = azurerm_storage_account.linux_test.name
+ container_access_type = "blob"
+}
+
+resource "azurerm_storage_blob" "linux_test" {
+ name = "scriptlinux"
+ storage_account_name = azurerm_storage_account.linux_test.name
+ storage_container_name = azurerm_storage_container.linux_test.name
+ type = "Page"
+ size = 512
+}
+
+resource "azurerm_storage_blob" "linux_test2" {
+ name = "script2linux"
+ storage_account_name = azurerm_storage_account.linux_test.name
+ storage_container_name = azurerm_storage_container.linux_test.name
+ type = "Page"
+ size = 512
+}
+
+resource "azurerm_shared_image_gallery" "linux_test" {
+ name = "acctestsiglinux%[2]d"
+ resource_group_name = azurerm_resource_group.linux_test.name
+ location = azurerm_resource_group.linux_test.location
+}
+
+resource "azurerm_gallery_application" "linux_test" {
+ name = "acctest-applinux-%[2]d"
+ gallery_id = azurerm_shared_image_gallery.linux_test.id
+ location = azurerm_shared_image_gallery.linux_test.location
+ supported_os_type = "Linux"
+}
+
+resource "azurerm_gallery_application_version" "linux_test" {
+ name = "0.0.1"
+ gallery_application_id = azurerm_gallery_application.linux_test.id
+ location = azurerm_gallery_application.linux_test.location
+
+ source {
+ media_link = azurerm_storage_blob.linux_test.id
+ default_configuration_link = azurerm_storage_blob.linux_test.id
+ }
+
+ manage_action {
+ install = "[install command]"
+ remove = "[remove command]"
+ }
+
+ target_region {
+ name = azurerm_gallery_application.linux_test.location
+ regional_replica_count = 1
+ storage_account_type = "Premium_LRS"
+ }
+}
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ gallery_application {
+ version_id = azurerm_gallery_application_version.test.id
+ configuration_blob_uri = azurerm_storage_blob.test2.id
+ order = 1
+ tag = "%[5]s"
+ automatic_upgrade_enabled = false
+ treat_failure_as_deployment_failure_enabled = false
+ }
+ }
+
+ additional_location_profile {
+ location = "%[6]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ gallery_application {
+ version_id = azurerm_gallery_application_version.linux_test.id
+ configuration_blob_uri = azurerm_storage_blob.linux_test2.id
+ order = 1
+ tag = "%[5]s"
+ automatic_upgrade_enabled = false
+ treat_failure_as_deployment_failure_enabled = false
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.RandomString, tag, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) licenseType(data acceptance.TestData, lType string) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ automatic_updates_enabled = true
+ provision_vm_agent_enabled = true
+ time_zone = "W. Europe Standard Time"
+
+ winrm_listener {
+ protocol = "Http"
+ }
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ license_type = "%[4]s"
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "MicrosoftWindowsServer"
+ offer = "WindowsServer"
+ sku = "2016-Datacenter-Server-Core"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ windows_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ automatic_updates_enabled = true
+ provision_vm_agent_enabled = true
+ time_zone = "W. Europe Standard Time"
+
+ winrm_listener {
+ protocol = "Http"
+ }
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.windows_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ license_type = "%[4]s"
+ }
+ }
+}
+`, r.baseAndAdditionalLocationWindowsTemplate(data), data.RandomInteger, data.Locations.Primary, lType, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) scheduledEvent(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ scheduled_event_termination_timeout = "PT5M"
+ scheduled_event_os_image_timeout = "PT15M"
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ scheduled_event_termination_timeout = "PT5M"
+ scheduled_event_os_image_timeout = "PT15M"
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) scheduledEventUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ scheduled_event_termination_timeout = "PT15M"
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ scheduled_event_termination_timeout = "PT15M"
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) userData(data acceptance.TestData, userDta string) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ user_data_base64 = base64encode("%[4]s")
+ }
+
+ additional_location_profile {
+ location = "%[5]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm-%[2]d"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ user_data_base64 = base64encode("%[4]s")
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, userDta, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) securityProfile(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_B1ls"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ encryption_at_host_enabled = true
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ data_disk {
+ lun = 0
+ caching = "ReadWrite"
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ encryption_at_host_enabled = true
+ secure_boot_enabled = true
+ vtpm_enabled = true
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ data_disk {
+ lun = 0
+ caching = "ReadWrite"
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) securityProfileUpdate(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_B1ls"
+ }
+
+ compute_api_version = "2023-09-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ encryption_at_host_enabled = false
+ secure_boot_enabled = false
+ vtpm_enabled = false
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ data_disk {
+ lun = 0
+ caching = "ReadWrite"
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ encryption_at_host_enabled = false
+ secure_boot_enabled = false
+ vtpm_enabled = false
+
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts-gen2"
+ version = "latest"
+ }
+
+ os_disk {
+ storage_account_type = "Standard_LRS"
+ caching = "ReadWrite"
+ }
+
+ data_disk {
+ lun = 0
+ caching = "ReadWrite"
+ create_option = "Empty"
+ disk_size_in_gb = 10
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
+
+func (r ComputeFleetTestResource) additionalCapabilitiesUltraSSD(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ additional_capabilities_ultra_ssd_enabled = true
+ zones = ["1", "2", "3"]
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary)
+}
+
+func (r ComputeFleetTestResource) additionalCapabilitiesHibernation(data acceptance.TestData) string {
+ return fmt.Sprintf(`
+%[1]s
+
+resource "azurerm_compute_fleet" "test" {
+ name = "acctest-fleet-%[2]d"
+ resource_group_name = azurerm_resource_group.test.name
+ location = "%[3]s"
+ additional_capabilities_hibernation_enabled = true
+
+ spot_priority_profile {
+ min_capacity = 1
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_DS1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+ }
+
+ additional_location_profile {
+ location = "%[4]s"
+ virtual_machine_profile_override {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "testvm"
+ admin_username = local.admin_username
+ admin_password = local.admin_password
+ password_authentication_enabled = true
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ primary = true
+ ip_configuration {
+ name = "TestIPConfiguration"
+ subnet_id = azurerm_subnet.linux_test.id
+ primary = true
+ public_ip_address {
+ name = "TestPublicIPConfiguration"
+ domain_name_label = "test-domain-label"
+ idle_timeout_in_minutes = 4
+ }
+ }
+ }
+
+ extension {
+ name = "HealthExtension"
+ publisher = "Microsoft.ManagedServices"
+ type = "ApplicationHealthLinux"
+ type_handler_version = "1.0"
+
+ settings_json = jsonencode({
+ "protocol" = "http"
+ "port" = 80
+ "requestPath" = "/healthEndpoint"
+ })
+ }
+ }
+ }
+}
+`, r.baseAndAdditionalLocationLinuxTemplate(data), data.RandomInteger, data.Locations.Primary, data.Locations.Secondary)
+}
diff --git a/internal/services/computefleet/compute_fleet_virtual_machine_profile.go b/internal/services/computefleet/compute_fleet_virtual_machine_profile.go
new file mode 100644
index 000000000000..0f30c88bcbeb
--- /dev/null
+++ b/internal/services/computefleet/compute_fleet_virtual_machine_profile.go
@@ -0,0 +1,2650 @@
+// Copyright (c) HashiCorp, Inc.
+// SPDX-License-Identifier: MPL-2.0
+
+package computefleet
+
+import (
+ "encoding/json"
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+
+ "github.com/hashicorp/go-azure-helpers/lang/pointer"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/capacityreservationgroups"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/images"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-03/galleryapplicationversions"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/applicationsecuritygroups"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/networksecuritygroups"
+ "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/publicipprefixes"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
+ azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
+ computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate"
+ keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/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"
+)
+
+func virtualMachineProfileSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Required: true,
+ ForceNew: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "os_profile": osProfileSchema(),
+
+ "network_api_version": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "network_interface": networkInterfaceSchema(),
+
+ "boot_diagnostic_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "boot_diagnostic_storage_account_endpoint": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "capacity_reservation_group_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: capacityreservationgroups.ValidateCapacityReservationGroupID,
+ },
+
+ "data_disk": storageProfileDataDiskSchema(),
+
+ "encryption_at_host_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "extension": extensionSchema(),
+
+ "extension_operations_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: true,
+ },
+
+ "extensions_time_budget": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: azValidate.ISO8601DurationBetween("PT15M", "PT2H"),
+ },
+
+ "gallery_application": galleryApplicationSchema(),
+
+ "license_type": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ "RHEL_BYOS",
+ "SLES_BYOS",
+ "Windows_Client",
+ "Windows_Server",
+ }, false),
+ },
+
+ "os_disk": storageProfileOsDiskSchema(),
+
+ "scheduled_event_os_image_timeout": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ "PT15M",
+ }, false),
+ },
+
+ "scheduled_event_termination_timeout": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: azValidate.ISO8601DurationBetween("PT5M", "PT15M"),
+ },
+
+ "secure_boot_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "source_image_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.Any(
+ images.ValidateImageID,
+ computeValidate.SharedImageID,
+ computeValidate.SharedImageVersionID,
+ computeValidate.CommunityGalleryImageID,
+ computeValidate.CommunityGalleryImageVersionID,
+ computeValidate.SharedGalleryImageID,
+ computeValidate.SharedGalleryImageVersionID,
+ ),
+ },
+
+ "source_image_reference": storageProfileSourceImageReferenceSchema(),
+
+ "user_data_base64": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsBase64,
+ },
+
+ "vtpm_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ }
+}
+
+func galleryApplicationSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 100,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "version_id": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: galleryapplicationversions.ValidateApplicationVersionID,
+ },
+
+ "automatic_upgrade_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "configuration_blob_uri": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.IsURLWithHTTPorHTTPS,
+ },
+
+ "order": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ Default: 0,
+ ValidateFunc: validation.IntBetween(0, 2147483647),
+ },
+
+ "tag": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "treat_failure_as_deployment_failure_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ }
+}
+
+func extensionSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "publisher": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "type": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "type_handler_version": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "auto_upgrade_minor_version_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "automatic_upgrade_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "extensions_to_provision_after_vm_creation": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+
+ "failure_suppression_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "force_extension_execution_on_change": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ },
+
+ "protected_settings_from_key_vault": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "secret_url": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: keyVaultValidate.NestedItemId,
+ },
+
+ "source_vault_id": commonschema.ResourceIDReferenceRequired(&commonids.KeyVaultId{}),
+ },
+ },
+ },
+
+ "protected_settings_json": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Sensitive: true,
+ ValidateFunc: validation.StringIsJSON,
+ },
+
+ "settings_json": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsJSON,
+ DiffSuppressFunc: pluginsdk.SuppressJsonDiff,
+ },
+ },
+ },
+ }
+}
+
+func networkInterfaceSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Required: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "ip_configuration": ipConfigurationSchema(),
+
+ "accelerated_networking_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "auxiliary_mode": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ // NOTE: because there is a `None` value in the possible values, it's handled in the Create/Update and Read functions.
+ string(fleets.NetworkInterfaceAuxiliaryModeAcceleratedConnections),
+ string(fleets.NetworkInterfaceAuxiliaryModeFloating),
+ }, false),
+ },
+
+ "auxiliary_sku": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ // NOTE: because there is a `None` value in the possible values, it's handled in the Create/Update and Read functions.
+ string(fleets.NetworkInterfaceAuxiliarySkuATwo),
+ string(fleets.NetworkInterfaceAuxiliarySkuAFour),
+ string(fleets.NetworkInterfaceAuxiliarySkuAEight),
+ string(fleets.NetworkInterfaceAuxiliarySkuAOne),
+ }, false),
+ },
+
+ "delete_option": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDiskDeleteOptionTypes(), false),
+ },
+
+ "dns_servers": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+
+ "ip_forwarding_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "network_security_group_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: networksecuritygroups.ValidateNetworkSecurityGroupID,
+ },
+
+ "primary": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ }
+}
+
+func ipConfigurationSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Required: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "subnet_id": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: commonids.ValidateSubnetID,
+ },
+
+ "application_gateway_backend_address_pool_ids": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString},
+ Set: pluginsdk.HashString,
+ },
+
+ "application_security_group_ids": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: applicationsecuritygroups.ValidateApplicationSecurityGroupID,
+ },
+ Set: pluginsdk.HashString,
+ MaxItems: 20,
+ },
+
+ "load_balancer_backend_address_pool_ids": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString},
+ Set: pluginsdk.HashString,
+ },
+
+ "primary": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "public_ip_address": publicIPAddressSchema(),
+
+ "version": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.IPVersionIPvFour),
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForIPVersion(), false),
+ },
+ },
+ },
+ }
+}
+
+func publicIPAddressSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "name": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "delete_option": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDeleteOptions(), false),
+ },
+
+ "domain_name_label": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "domain_name_label_scope": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDomainNameLabelScopeTypes(), false),
+ },
+
+ "idle_timeout_in_minutes": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(4, 32),
+ },
+
+ "ip_tag": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "tag": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ "type": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+ },
+ },
+
+ "public_ip_prefix_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: publicipprefixes.ValidatePublicIPPrefixID,
+ },
+
+ // since "BasicSkuPublicIpIsNotAllowedForVmssFlex", the possible values are `Standard_Regional` and `Standard_Global`
+ "sku_name": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ string("Standard_Regional"),
+ string("Standard_Global"),
+ }, false),
+ },
+
+ "version": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.IPVersionIPvFour),
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForIPVersion(), false),
+ },
+ },
+ },
+ }
+}
+
+func osProfileSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Required: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "custom_data_base64": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Sensitive: true,
+ ValidateFunc: validation.StringIsBase64,
+ },
+
+ "linux_configuration": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ ForceNew: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "admin_username": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validateAdminUsernameLinux,
+ },
+
+ "computer_name_prefix": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: computeValidate.LinuxComputerNamePrefix,
+ },
+
+ "admin_password": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Sensitive: true,
+ ValidateFunc: validatePasswordComplexityLinux,
+ },
+
+ "admin_ssh_keys": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ Elem: &pluginsdk.Schema{
+ Type: pluginsdk.TypeString,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+
+ "bypass_platform_safety_checks_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "password_authentication_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "patch_assessment_mode": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ // 'patchSettings.assessmentMode' cannot be set to 'AutomaticByPlatform' as its not supported on Virtual Machine Scale Sets.
+ ValidateFunc: validation.StringInSlice([]string{string(fleets.LinuxPatchAssessmentModeImageDefault)}, false),
+ },
+
+ "patch_mode": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForLinuxVMGuestPatchMode(), false),
+ },
+
+ "provision_vm_agent_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: true,
+ },
+
+ "reboot_setting": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting(), false),
+ },
+
+ "secret": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "key_vault_id": commonschema.ResourceIDReferenceRequired(&commonids.KeyVaultId{}),
+
+ "certificate": {
+ Type: pluginsdk.TypeSet,
+ Required: true,
+ MinItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ // whilst we /could/ flatten this to `certificate_urls` we're intentionally not to keep this
+ // closer to the Windows VMSS resource, which will also take a `store` param
+ "url": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: keyVaultValidate.NestedItemId,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+
+ "vm_agent_platform_updates_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ },
+
+ "windows_configuration": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ ForceNew: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "admin_username": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validateAdminUsernameWindows,
+ },
+
+ "admin_password": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ Sensitive: true,
+ ValidateFunc: validatePasswordComplexityWindows,
+ },
+
+ "computer_name_prefix": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: computeValidate.WindowsComputerNamePrefix,
+ },
+
+ "additional_unattend_content": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "content": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ Sensitive: true,
+ },
+ "setting": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForSettingNames(), false),
+ },
+ },
+ },
+ },
+
+ "automatic_updates_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: true,
+ },
+
+ "bypass_platform_safety_checks_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "hot_patching_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "patch_assessment_mode": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ // 'patchSettings.assessmentMode' cannot be set to 'AutomaticByPlatform' as its not supported on Virtual Machine Scale Sets.
+ ValidateFunc: validation.StringInSlice([]string{string(fleets.WindowsPatchAssessmentModeImageDefault)}, false),
+ },
+
+ "patch_mode": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForWindowsVMGuestPatchMode(), false),
+ },
+
+ "provision_vm_agent_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: true,
+ },
+
+ "reboot_setting": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting(), false),
+ },
+
+ "secret": {
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "key_vault_id": commonschema.ResourceIDReferenceRequired(&commonids.KeyVaultId{}),
+
+ "certificate": {
+ Type: pluginsdk.TypeSet,
+ Required: true,
+ MinItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "url": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: keyVaultValidate.NestedItemId,
+ },
+
+ "store": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+
+ "time_zone": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ForceNew: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "vm_agent_platform_updates_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+
+ "winrm_listener": {
+ Type: pluginsdk.TypeSet,
+ Optional: true,
+ ForceNew: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "protocol": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ForceNew: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForProtocolTypes(), false),
+ },
+ "certificate_url": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ForceNew: true,
+ ValidateFunc: keyVaultValidate.NestedItemId,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func storageProfileDataDiskSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "create_option": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ string(fleets.DiskCreateOptionTypesEmpty),
+ string(fleets.DiskCreateOptionTypesFromImage),
+ }, false),
+ },
+
+ "caching": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ // NOTE: because there is a `None` value in the possible values, it's handled in the Create/Update and Read functions.
+ string(fleets.CachingTypesReadOnly),
+ string(fleets.CachingTypesReadWrite),
+ }, false),
+ },
+
+ "delete_option": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDiskDeleteOptionTypes(), false),
+ },
+
+ "disk_encryption_set_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: computeValidate.DiskEncryptionSetID,
+ },
+
+ "disk_size_in_gb": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(1, 32767),
+ },
+
+ "lun": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(0, 2000),
+ },
+
+ "storage_account_type": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForStorageAccountTypes(), false),
+ },
+
+ "write_accelerator_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ }
+}
+
+func storageProfileOsDiskSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "caching": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice([]string{
+ // NOTE: because there is a `None` value in the possible values, it's handled in the Create/Update and Read functions.
+ string(fleets.CachingTypesReadOnly),
+ string(fleets.CachingTypesReadWrite),
+ }, false),
+ },
+
+ "delete_option": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Default: string(fleets.DiskDeleteOptionTypesDelete),
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDiskDeleteOptionTypes(), false),
+ },
+
+ "diff_disk_option": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDiffDiskOptions(), false),
+ },
+
+ "diff_disk_placement": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForDiffDiskPlacement(), false),
+ },
+
+ "disk_encryption_set_id": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: computeValidate.DiskEncryptionSetID,
+ },
+
+ "disk_size_in_gb": {
+ Type: pluginsdk.TypeInt,
+ Optional: true,
+ ValidateFunc: validation.IntBetween(1, 32767),
+ },
+
+ "security_encryption_type": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ ValidateFunc: validation.StringInSlice(fleets.PossibleValuesForSecurityEncryptionTypes(), false),
+ },
+
+ "storage_account_type": {
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ // NOTE: OS Disks don't support Ultra SSDs or PremiumV2_LRS
+ ValidateFunc: validation.StringInSlice([]string{
+ string(fleets.StorageAccountTypesPremiumLRS),
+ string(fleets.StorageAccountTypesPremiumZRS),
+ string(fleets.StorageAccountTypesStandardLRS),
+ string(fleets.StorageAccountTypesStandardSSDLRS),
+ string(fleets.StorageAccountTypesStandardSSDZRS),
+ }, false),
+ },
+
+ "write_accelerator_enabled": {
+ Type: pluginsdk.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ },
+ }
+}
+
+func storageProfileSourceImageReferenceSchema() *pluginsdk.Schema {
+ return &pluginsdk.Schema{
+ Type: pluginsdk.TypeList,
+ Optional: true,
+ MaxItems: 1,
+ Elem: &pluginsdk.Resource{
+ Schema: map[string]*pluginsdk.Schema{
+ "offer": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "publisher": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "sku": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+
+ "version": {
+ Type: pluginsdk.TypeString,
+ Required: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ },
+ },
+ },
+ }
+}
+
+func expandVirtualMachineProfileModel(inputList []VirtualMachineProfileModel, d *schema.ResourceData, isAdditional bool, withVMAttributes bool) (*fleets.BaseVirtualMachineProfile, error) {
+ input := &inputList[0]
+ output := fleets.BaseVirtualMachineProfile{
+ OsProfile: expandOSProfileModel(inputList),
+ ApplicationProfile: expandApplicationProfileModel(input.GalleryApplicationProfile),
+ DiagnosticsProfile: &fleets.DiagnosticsProfile{
+ BootDiagnostics: &fleets.BootDiagnostics{
+ Enabled: pointer.To(input.BootDiagnosticEnabled),
+ StorageUri: pointer.To(input.BootDiagnosticStorageAccountEndpoint),
+ },
+ },
+ }
+
+ if input.ScheduledEventTerminationTimeout != "" {
+ output.ScheduledEventsProfile = &fleets.ScheduledEventsProfile{
+ TerminateNotificationProfile: &fleets.TerminateNotificationProfile{
+ Enable: pointer.To(true),
+ NotBeforeTimeout: pointer.To(input.ScheduledEventTerminationTimeout),
+ },
+ }
+ }
+
+ if input.ScheduledEventOsImageTimeout != "" {
+ if output.ScheduledEventsProfile == nil {
+ output.ScheduledEventsProfile = &fleets.ScheduledEventsProfile{}
+ }
+ output.ScheduledEventsProfile.OsImageNotificationProfile = &fleets.OSImageNotificationProfile{
+ Enable: pointer.To(true),
+ NotBeforeTimeout: pointer.To(input.ScheduledEventOsImageTimeout),
+ }
+ }
+
+ if input.CapacityReservationGroupId != "" {
+ output.CapacityReservation = &fleets.CapacityReservationProfile{
+ CapacityReservationGroup: expandSubResource(input.CapacityReservationGroupId),
+ }
+ }
+
+ if isAdditional {
+ encryptionAtHostEnabledExist := d.GetRawConfig().AsValueMap()["additional_location_profile"].AsValueSlice()[0].AsValueMap()["virtual_machine_profile_override"].AsValueSlice()[0].AsValueMap()["encryption_at_host_enabled"]
+ if !encryptionAtHostEnabledExist.IsNull() {
+ output.SecurityProfile = &fleets.SecurityProfile{
+ EncryptionAtHost: pointer.To(input.EncryptionAtHostEnabled),
+ }
+ }
+ } else {
+ encryptionAtHostEnabledExist := d.GetRawConfig().AsValueMap()["virtual_machine_profile"].AsValueSlice()[0].AsValueMap()["encryption_at_host_enabled"]
+ if !encryptionAtHostEnabledExist.IsNull() {
+ output.SecurityProfile = &fleets.SecurityProfile{
+ EncryptionAtHost: pointer.To(input.EncryptionAtHostEnabled),
+ }
+ }
+ }
+
+ if v := input.OsDisk; len(v) > 0 && v[0].SecurityEncryptionType != "" {
+ if output.SecurityProfile == nil {
+ output.SecurityProfile = &fleets.SecurityProfile{}
+ }
+ output.SecurityProfile.SecurityType = pointer.To(fleets.SecurityTypesConfidentialVM)
+ output.SecurityProfile.UefiSettings = &fleets.UefiSettings{
+ SecureBootEnabled: pointer.To(input.SecureBootEnabled),
+ VTpmEnabled: pointer.To(input.VTpmEnabled),
+ }
+ } else {
+ if input.SecureBootEnabled {
+ if output.SecurityProfile == nil {
+ output.SecurityProfile = &fleets.SecurityProfile{}
+ }
+ output.SecurityProfile.UefiSettings = &fleets.UefiSettings{
+ SecureBootEnabled: pointer.To(input.SecureBootEnabled),
+ }
+ output.SecurityProfile.SecurityType = pointer.To(fleets.SecurityTypesTrustedLaunch)
+ }
+
+ if input.VTpmEnabled {
+ if output.SecurityProfile == nil {
+ output.SecurityProfile = &fleets.SecurityProfile{}
+ }
+ if output.SecurityProfile.UefiSettings == nil {
+ output.SecurityProfile.UefiSettings = &fleets.UefiSettings{}
+ }
+ output.SecurityProfile.UefiSettings.VTpmEnabled = pointer.To(input.VTpmEnabled)
+
+ output.SecurityProfile.SecurityType = pointer.To(fleets.SecurityTypesTrustedLaunch)
+ }
+ }
+
+ output.NetworkProfile = &fleets.VirtualMachineScaleSetNetworkProfile{
+ NetworkApiVersion: pointer.To(fleets.NetworkApiVersion(input.NetworkApiVersion)),
+ NetworkInterfaceConfigurations: expandNetworkInterfaceModel(input.NetworkInterface),
+ }
+
+ extensionProfileValue, err := expandExtensionModel(input.Extension, input.ExtensionsTimeBudget)
+ if err != nil {
+ return nil, err
+ }
+ output.ExtensionProfile = extensionProfileValue
+
+ output.LicenseType = pointer.To("None")
+ if input.LicenseType != "" {
+ output.LicenseType = pointer.To(input.LicenseType)
+ }
+
+ if input.UserDataBase64 != "" {
+ output.UserData = pointer.To(input.UserDataBase64)
+ }
+
+ storageProfile := &fleets.VirtualMachineScaleSetStorageProfile{
+ ImageReference: expandImageReference(input.SourceImageReference, input.SourceImageId),
+ OsDisk: expandOSDiskModel(input, withVMAttributes, isAdditional),
+ DataDisks: expandDataDiskModel(input.DataDisks),
+ }
+
+ output.StorageProfile = storageProfile
+
+ return &output, nil
+}
+
+func expandApplicationProfileModel(inputList []GalleryApplicationModel) *fleets.ApplicationProfile {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.VMGalleryApplication, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.VMGalleryApplication{
+ EnableAutomaticUpgrade: pointer.To(input.AutomaticUpgradeEnabled),
+ Order: pointer.To(input.Order),
+ PackageReferenceId: input.VersionId,
+ TreatFailureAsDeploymentFailure: pointer.To(input.TreatFailureAsDeploymentFailureEnabled),
+ }
+
+ if input.ConfigurationBlobUri != "" {
+ output.ConfigurationReference = pointer.To(input.ConfigurationBlobUri)
+ }
+
+ if input.Tag != "" {
+ output.Tags = pointer.To(input.Tag)
+ }
+ outputList = append(outputList, output)
+ }
+
+ return &fleets.ApplicationProfile{
+ GalleryApplications: &outputList,
+ }
+}
+
+func expandSubResource(input string) *fleets.SubResource {
+ if input == "" {
+ return nil
+ }
+
+ return &fleets.SubResource{
+ Id: pointer.To(input),
+ }
+}
+
+func expandSubResources(inputList []string) *[]fleets.SubResource {
+ if len(inputList) == 0 {
+ return nil
+ }
+ outputList := make([]fleets.SubResource, 0)
+ for _, v := range inputList {
+ input := v
+
+ output := expandSubResource(input)
+ if output != nil {
+ outputList = append(outputList, pointer.From(output))
+ }
+ }
+
+ return &outputList
+}
+
+func expandExtensionModel(inputList []ExtensionModel, timeBudget string) (*fleets.VirtualMachineScaleSetExtensionProfile, error) {
+ if len(inputList) == 0 {
+ return nil, nil
+ }
+
+ output := fleets.VirtualMachineScaleSetExtensionProfile{}
+ extensions := make([]fleets.VirtualMachineScaleSetExtension, 0)
+ for _, v := range inputList {
+ extension := fleets.VirtualMachineScaleSetExtension{}
+
+ if v.Name != "" {
+ extension.Name = pointer.To(v.Name)
+ }
+
+ propertiesValue := fleets.VirtualMachineScaleSetExtensionProperties{
+ AutoUpgradeMinorVersion: pointer.To(v.AutoUpgradeMinorVersionEnabled),
+ SuppressFailures: pointer.To(v.FailureSuppressionEnabled),
+ EnableAutomaticUpgrade: pointer.To(v.AutomaticUpgradeEnabled),
+ }
+
+ if len(v.ProtectedSettingsFromKeyVault) > 0 {
+ propertiesValue.ProtectedSettingsFromKeyVault = &fleets.KeyVaultSecretReference{
+ SecretURL: v.ProtectedSettingsFromKeyVault[0].SecretUrl,
+ SourceVault: pointer.From(expandSubResource(v.ProtectedSettingsFromKeyVault[0].SourceVaultId)),
+ }
+ }
+
+ if v.ForceExtensionExecutionOnChange != "" {
+ propertiesValue.ForceUpdateTag = pointer.To(v.ForceExtensionExecutionOnChange)
+ }
+
+ if v.ProtectedSettingsJson != "" {
+ protectedSettingsValue := make(map[string]interface{})
+ err := json.Unmarshal([]byte(v.ProtectedSettingsJson), &protectedSettingsValue)
+ if err != nil {
+ return nil, fmt.Errorf("unmarshaling `protected_settings_json`: %+v", err)
+ }
+ propertiesValue.ProtectedSettings = pointer.To(protectedSettingsValue)
+ }
+
+ if len(v.ExtensionsToProvisionAfterVmCreation) > 0 {
+ propertiesValue.ProvisionAfterExtensions = pointer.To(v.ExtensionsToProvisionAfterVmCreation)
+ }
+
+ if v.Publisher != "" {
+ propertiesValue.Publisher = pointer.To(v.Publisher)
+ }
+
+ if v.SettingsJson != "" {
+ result := make(map[string]interface{})
+ err := json.Unmarshal([]byte(v.SettingsJson), &result)
+ if err != nil {
+ return nil, fmt.Errorf("unmarshaling `settings_json`: %+v", err)
+ }
+ propertiesValue.Settings = pointer.To(result)
+ }
+
+ if v.Type != "" {
+ propertiesValue.Type = pointer.To(v.Type)
+ }
+
+ if v.TypeHandlerVersion != "" {
+ propertiesValue.TypeHandlerVersion = pointer.To(v.TypeHandlerVersion)
+ }
+ extension.Properties = &propertiesValue
+ extensions = append(extensions, extension)
+ }
+
+ output.Extensions = &extensions
+
+ if timeBudget != "" {
+ output.ExtensionsTimeBudget = pointer.To(timeBudget)
+ }
+ return &output, nil
+}
+
+func expandNetworkInterfaceModel(inputList []NetworkInterfaceModel) *[]fleets.VirtualMachineScaleSetNetworkConfiguration {
+ outputList := make([]fleets.VirtualMachineScaleSetNetworkConfiguration, 0)
+ for _, v := range inputList {
+ output := fleets.VirtualMachineScaleSetNetworkConfiguration{
+ Name: v.Name,
+ Properties: &fleets.VirtualMachineScaleSetNetworkConfigurationProperties{
+ EnableAcceleratedNetworking: pointer.To(v.AcceleratedNetworkingEnabled),
+ EnableIPForwarding: pointer.To(v.IPForwardingEnabled),
+ NetworkSecurityGroup: expandSubResource(v.NetworkSecurityGroupId),
+ Primary: pointer.To(v.Primary),
+ },
+ }
+
+ if len(v.DnsServers) > 0 {
+ output.Properties.DnsSettings = &fleets.VirtualMachineScaleSetNetworkConfigurationDnsSettings{
+ DnsServers: pointer.To(v.DnsServers),
+ }
+ }
+
+ auxiliaryMode := fleets.NetworkInterfaceAuxiliaryModeNone
+ if v.AuxiliaryMode != "" {
+ auxiliaryMode = fleets.NetworkInterfaceAuxiliaryMode(v.AuxiliaryMode)
+ }
+ output.Properties.AuxiliaryMode = pointer.To(auxiliaryMode)
+
+ if v.DeleteOption != "" {
+ output.Properties.DeleteOption = pointer.To(fleets.DeleteOptions(v.DeleteOption))
+ }
+
+ auxiliarySku := fleets.NetworkInterfaceAuxiliarySkuNone
+ if v.AuxiliarySku != "" {
+ auxiliarySku = fleets.NetworkInterfaceAuxiliarySku(v.AuxiliarySku)
+ }
+ output.Properties.AuxiliarySku = pointer.To(auxiliarySku)
+
+ output.Properties.IPConfigurations = pointer.From(expandIPConfigurationModel(v.IPConfiguration))
+
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandIPConfigurationModel(inputList []IPConfigurationModel) *[]fleets.VirtualMachineScaleSetIPConfiguration {
+ outputList := make([]fleets.VirtualMachineScaleSetIPConfiguration, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.VirtualMachineScaleSetIPConfiguration{
+ Name: input.Name,
+ Properties: &fleets.VirtualMachineScaleSetIPConfigurationProperties{
+ ApplicationGatewayBackendAddressPools: expandSubResources(input.ApplicationGatewayBackendAddressPoolIds),
+ ApplicationSecurityGroups: expandSubResources(input.ApplicationSecurityGroupIds),
+ LoadBalancerBackendAddressPools: expandSubResources(input.LoadBalancerBackendAddressPoolIds),
+ Primary: pointer.To(input.Primary),
+ PublicIPAddressConfiguration: expandPublicIPAddressModel(input.PublicIPAddress),
+ },
+ }
+
+ if input.SubnetId != "" {
+ output.Properties.Subnet = &fleets.ApiEntityReference{
+ Id: pointer.To(input.SubnetId),
+ }
+ }
+
+ if input.Version != "" {
+ output.Properties.PrivateIPAddressVersion = pointer.To(fleets.IPVersion(input.Version))
+ }
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandPublicIPAddressModel(inputList []PublicIPAddressModel) *fleets.VirtualMachineScaleSetPublicIPAddressConfiguration {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ output := fleets.VirtualMachineScaleSetPublicIPAddressConfiguration{
+ Name: input.Name,
+ Properties: &fleets.VirtualMachineScaleSetPublicIPAddressConfigurationProperties{
+ IPTags: expandIPTagModel(input.IPTag),
+ PublicIPPrefix: expandSubResource(input.PublicIPPrefix),
+ },
+ }
+
+ if input.DomainNameLabel != "" {
+ output.Properties.DnsSettings = &fleets.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings{
+ DomainNameLabel: input.DomainNameLabel,
+ }
+ }
+
+ if input.DomainNameLabelScope != "" {
+ if output.Properties.DnsSettings == nil {
+ output.Properties.DnsSettings = &fleets.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings{}
+ }
+ output.Properties.DnsSettings.DomainNameLabelScope = pointer.To(fleets.DomainNameLabelScopeTypes(input.DomainNameLabelScope))
+ }
+
+ if v := input.SkuName; v != "" {
+ skuParts := strings.Split(v, "_")
+ output.Sku = &fleets.PublicIPAddressSku{
+ Name: pointer.To(fleets.PublicIPAddressSkuName(skuParts[0])),
+ Tier: pointer.To(fleets.PublicIPAddressSkuTier(skuParts[1])),
+ }
+ }
+
+ if input.IdleTimeoutInMinutes > 0 {
+ output.Properties.IdleTimeoutInMinutes = pointer.To(input.IdleTimeoutInMinutes)
+ }
+ if input.DeleteOption != "" {
+ output.Properties.DeleteOption = pointer.To(fleets.DeleteOptions(input.DeleteOption))
+ }
+ if input.Version != "" {
+ output.Properties.PublicIPAddressVersion = pointer.To(fleets.IPVersion(input.Version))
+ }
+
+ return &output
+}
+
+func expandIPTagModel(inputList []IPTagModel) *[]fleets.VirtualMachineScaleSetIPTag {
+ outputList := make([]fleets.VirtualMachineScaleSetIPTag, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.VirtualMachineScaleSetIPTag{}
+
+ if input.Type != "" {
+ output.IPTagType = pointer.To(input.Type)
+ }
+
+ if input.Tag != "" {
+ output.Tag = pointer.To(input.Tag)
+ }
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandOSProfileModel(inputList []VirtualMachineProfileModel) *fleets.VirtualMachineScaleSetOSProfile {
+ osProfile := &inputList[0].OsProfile[0]
+ output := fleets.VirtualMachineScaleSetOSProfile{
+ AllowExtensionOperations: pointer.To(inputList[0].ExtensionOperationsEnabled),
+ }
+ if osProfile.CustomDataBase64 != "" {
+ output.CustomData = pointer.To(osProfile.CustomDataBase64)
+ }
+
+ if lConfig := osProfile.LinuxConfiguration; len(lConfig) > 0 {
+ linuxConfig := fleets.LinuxConfiguration{
+ DisablePasswordAuthentication: pointer.To(!lConfig[0].PasswordAuthenticationEnabled),
+ ProvisionVMAgent: pointer.To(lConfig[0].ProvisionVMAgentEnabled),
+ EnableVMAgentPlatformUpdates: pointer.To(lConfig[0].VMAgentPlatformUpdatesEnabled),
+ PatchSettings: &fleets.LinuxPatchSettings{},
+ }
+
+ // AutomaticByPlatformSettings cannot be set if the PatchMode is not `AutomaticByPlatform`
+ if lConfig[0].PatchMode == string(fleets.LinuxVMGuestPatchModeAutomaticByPlatform) {
+ linuxConfig.PatchSettings.AutomaticByPlatformSettings = &fleets.LinuxVMGuestPatchAutomaticByPlatformSettings{
+ BypassPlatformSafetyChecksOnUserSchedule: pointer.To(lConfig[0].BypassPlatformSafetyChecksEnabled),
+ }
+
+ if lConfig[0].RebootSetting != "" {
+ linuxConfig.PatchSettings.AutomaticByPlatformSettings.RebootSetting = pointer.To(fleets.LinuxVMGuestPatchAutomaticByPlatformRebootSetting(lConfig[0].RebootSetting))
+ }
+ }
+ if lConfig[0].PatchAssessmentMode != "" {
+ linuxConfig.PatchSettings.AssessmentMode = pointer.To(fleets.LinuxPatchAssessmentMode(lConfig[0].PatchAssessmentMode))
+ }
+ if lConfig[0].PatchMode != "" {
+ linuxConfig.PatchSettings.PatchMode = pointer.To(fleets.LinuxVMGuestPatchMode(lConfig[0].PatchMode))
+ }
+ if lConfig[0].AdminUsername != "" {
+ output.AdminUsername = pointer.To(lConfig[0].AdminUsername)
+ }
+ if lConfig[0].AdminPassword != "" {
+ output.AdminPassword = pointer.To(lConfig[0].AdminPassword)
+ }
+ if lConfig[0].ComputerNamePrefix != "" {
+ output.ComputerNamePrefix = pointer.To(lConfig[0].ComputerNamePrefix)
+ }
+ output.Secrets = expandOsProfileLinuxSecretsModel(lConfig[0].Secret)
+
+ if lConfig[0].AdminUsername != "" || len(lConfig[0].AdminSSHKeys) > 0 {
+ publicKeys := make([]fleets.SshPublicKey, 0)
+ for _, v := range lConfig[0].AdminSSHKeys {
+ output := fleets.SshPublicKey{
+ Path: pointer.To(fmt.Sprintf("/home/%s/.ssh/authorized_keys", lConfig[0].AdminUsername)),
+ }
+ if v != "" {
+ output.KeyData = pointer.To(v)
+ }
+ publicKeys = append(publicKeys, output)
+ }
+
+ linuxConfig.Ssh = &fleets.SshConfiguration{
+ PublicKeys: pointer.To(publicKeys),
+ }
+ }
+
+ output.LinuxConfiguration = &linuxConfig
+ }
+
+ if winConfig := osProfile.WindowsConfiguration; len(winConfig) > 0 {
+ windowsConfig := fleets.WindowsConfiguration{
+ AdditionalUnattendContent: expandAdditionalUnAttendContentModel(winConfig[0].AdditionalUnattendContent),
+ EnableAutomaticUpdates: pointer.To(winConfig[0].AutomaticUpdatesEnabled),
+ EnableVMAgentPlatformUpdates: pointer.To(winConfig[0].VMAgentPlatformUpdatesEnabled),
+ ProvisionVMAgent: pointer.To(winConfig[0].ProvisionVMAgentEnabled),
+ PatchSettings: &fleets.PatchSettings{
+ EnableHotpatching: pointer.To(winConfig[0].HotPatchingEnabled),
+ },
+ }
+
+ if winRm := winConfig[0].WinRM; len(winRm) > 0 {
+ listenerList := make([]fleets.WinRMListener, 0)
+ for _, v := range winRm {
+ output := fleets.WinRMListener{
+ Protocol: pointer.To(fleets.ProtocolTypes(v.Protocol)),
+ }
+
+ if v.CertificateUrl != "" {
+ output.CertificateURL = pointer.To(v.CertificateUrl)
+ }
+ listenerList = append(listenerList, output)
+ }
+ windowsConfig.WinRM = &fleets.WinRMConfiguration{
+ Listeners: pointer.To(listenerList),
+ }
+ }
+
+ if winConfig[0].AdminUsername != "" {
+ output.AdminUsername = pointer.To(winConfig[0].AdminUsername)
+ }
+ if winConfig[0].AdminPassword != "" {
+ output.AdminPassword = pointer.To(winConfig[0].AdminPassword)
+ }
+ if winConfig[0].ComputerNamePrefix != "" {
+ output.ComputerNamePrefix = pointer.To(winConfig[0].ComputerNamePrefix)
+ }
+
+ // AutomaticByPlatformSettings cannot be set if the PatchMode is not `AutomaticByPlatform`
+ if winConfig[0].PatchMode == string(fleets.WindowsVMGuestPatchModeAutomaticByPlatform) {
+ windowsConfig.PatchSettings.AutomaticByPlatformSettings = &fleets.WindowsVMGuestPatchAutomaticByPlatformSettings{
+ BypassPlatformSafetyChecksOnUserSchedule: pointer.To(winConfig[0].BypassPlatformSafetyChecksEnabled),
+ }
+
+ if winConfig[0].RebootSetting != "" {
+ windowsConfig.PatchSettings.AutomaticByPlatformSettings.RebootSetting = pointer.To(fleets.WindowsVMGuestPatchAutomaticByPlatformRebootSetting(winConfig[0].RebootSetting))
+ }
+ }
+ if winConfig[0].PatchAssessmentMode != "" {
+ windowsConfig.PatchSettings.AssessmentMode = pointer.To(fleets.WindowsPatchAssessmentMode(winConfig[0].PatchAssessmentMode))
+ }
+ if winConfig[0].PatchMode != "" {
+ windowsConfig.PatchSettings.PatchMode = pointer.To(fleets.WindowsVMGuestPatchMode(winConfig[0].PatchMode))
+ }
+ if winConfig[0].TimeZone != "" {
+ windowsConfig.TimeZone = pointer.To(winConfig[0].TimeZone)
+ }
+ output.WindowsConfiguration = &windowsConfig
+
+ output.Secrets = expandOsProfileWindowsSecretsModel(winConfig[0].Secret)
+ }
+
+ return &output
+}
+
+func validateWindowsSetting(inputList []VirtualMachineProfileModel, d *schema.ResourceDiff, isAdditional bool) error {
+ if len(inputList) == 0 || len(inputList[0].OsProfile) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ if v := input.OsProfile[0].WindowsConfiguration; len(v) > 0 {
+ patchMode := v[0].PatchMode
+ patchAssessmentMode := v[0].PatchAssessmentMode
+ hotPatchingEnabled := v[0].HotPatchingEnabled
+ provisionVMAgentEnabled := v[0].ProvisionVMAgentEnabled
+
+ rebootSetting := v[0].RebootSetting
+ bypassPlatformSafetyChecksEnabledExist := d.GetRawConfig().AsValueMap()["virtual_machine_profile"].AsValueSlice()[0].AsValueMap()["os_profile"].AsValueSlice()[0].AsValueMap()["windows_configuration"].AsValueSlice()[0].AsValueMap()["bypass_platform_safety_checks_enabled"]
+ if isAdditional {
+ bypassPlatformSafetyChecksEnabledExist = d.GetRawConfig().AsValueMap()["additional_location_profile"].AsValueSlice()[0].AsValueMap()["virtual_machine_profile_override"].AsValueSlice()[0].AsValueMap()["os_profile"].AsValueSlice()[0].AsValueMap()["windows_configuration"].AsValueSlice()[0].AsValueMap()["bypass_platform_safety_checks_enabled"]
+ }
+ if !bypassPlatformSafetyChecksEnabledExist.IsNull() || rebootSetting != "" {
+ if patchMode != string(fleets.WindowsVMGuestPatchModeAutomaticByPlatform) {
+ return fmt.Errorf("`bypass_platform_safety_checks_enabled` and `reboot_setting` cannot be set if the `PatchMode` is not `AutomaticByPlatform`")
+ }
+ }
+
+ if input.ExtensionOperationsEnabled && !provisionVMAgentEnabled {
+ return fmt.Errorf("`extension_operations_enabled` cannot be set to `true` when `provision_vm_agent_enabled` is set to `false`")
+ }
+
+ if patchAssessmentMode == string(fleets.WindowsPatchAssessmentModeAutomaticByPlatform) && !provisionVMAgentEnabled {
+ return fmt.Errorf("when the `patch_assessment_mode` field is set to %q the `provision_vm_agent_enabled` must always be set to `true`", fleets.WindowsPatchAssessmentModeAutomaticByPlatform)
+ }
+
+ isHotPatchEnabledImage := isValidHotPatchSourceImageReference(input.SourceImageReference)
+ hasHealthExtension := false
+ if v := input.Extension; len(v) > 0 && (v[0].Type == "ApplicationHealthLinux" || v[0].Type == "ApplicationHealthWindows") {
+ hasHealthExtension = true
+ }
+
+ if isHotPatchEnabledImage {
+ // it is a hot patching enabled image, validate hot patching enabled settings
+ if patchMode != string(fleets.WindowsVMGuestPatchModeAutomaticByPlatform) {
+ return fmt.Errorf("when referencing a hot patching enabled image the `patch_mode` field must always be set to %q", fleets.WindowsVMGuestPatchModeAutomaticByPlatform)
+ }
+ if !provisionVMAgentEnabled {
+ return fmt.Errorf("when referencing a hot patching enabled image the `provision_vm_agent_enabled` field must always be set to `true`")
+ }
+ if !hasHealthExtension {
+ return fmt.Errorf("when referencing a hot patching enabled image the `extension` field must always contain a `application health extension`")
+ }
+ if !hotPatchingEnabled {
+ return fmt.Errorf("when referencing a hot patching enabled image the `hot_patching_enabled` field must always be set to `true`")
+ }
+ } else {
+ // not a hot patching enabled image verify Automatic VM Guest Patching settings
+ if patchMode == string(fleets.WindowsVMGuestPatchModeAutomaticByPlatform) {
+ if !provisionVMAgentEnabled {
+ return fmt.Errorf("when `patch_mode` is set to %q then `provision_vm_agent_enabled` must be set to `true`", patchMode)
+ }
+ if !hasHealthExtension {
+ return fmt.Errorf("when `patch_mode` is set to %q then the `extension` field must always contain a `application health extension`", patchMode)
+ }
+ }
+
+ if hotPatchingEnabled {
+ return fmt.Errorf("`hot_patching_enabled` field is not supported unless you are using one of the following hot patching enable images, `2022-datacenter-azure-edition-core`, `2022-datacenter-azure-edition-core-smalldisk`, `2022-datacenter-azure-edition-hotpatch` or `2022-datacenter-azure-edition-hotpatch-smalldisk`")
+ }
+ }
+ }
+ return nil
+}
+
+func validateSecuritySetting(inputList []VirtualMachineProfileModel) error {
+ if len(inputList) == 0 || len(inputList[0].OsProfile) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ if v := input.OsDisk; len(v) > 0 {
+ secureBootEnabled := input.SecureBootEnabled
+ vTpmEnabled := input.VTpmEnabled
+ if v[0].SecurityEncryptionType != "" {
+ if fleets.SecurityEncryptionTypesDiskWithVMGuestState == fleets.SecurityEncryptionTypes(v[0].SecurityEncryptionType) && (!secureBootEnabled || !vTpmEnabled) {
+ return fmt.Errorf("`secure_boot_enabled` and `vtpm_enabled` must be set to `true` when `os_disk.0.security_encryption_type` is set to `DiskWithVMGuestState`")
+ }
+ if !vTpmEnabled {
+ return fmt.Errorf("`vtpm_enabled` must be set to `true` when `os_disk.0.security_encryption_type` is set")
+ }
+ }
+ }
+ return nil
+}
+
+func validateLinuxSetting(inputList []VirtualMachineProfileModel, d *schema.ResourceDiff, isAdditional bool) error {
+ if len(inputList) == 0 || len(inputList[0].OsProfile) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ if v := input.OsProfile[0].LinuxConfiguration; len(v) > 0 {
+ patchMode := v[0].PatchMode
+ patchAssessmentMode := v[0].PatchAssessmentMode
+ provisionVMAgentEnabled := v[0].ProvisionVMAgentEnabled
+
+ rebootSetting := v[0].RebootSetting
+ bypassPlatformSafetyChecksEnabledExist := d.GetRawConfig().AsValueMap()["virtual_machine_profile"].AsValueSlice()[0].AsValueMap()["os_profile"].AsValueSlice()[0].AsValueMap()["linux_configuration"].AsValueSlice()[0].AsValueMap()["bypass_platform_safety_checks_enabled"]
+ if isAdditional {
+ bypassPlatformSafetyChecksEnabledExist = d.GetRawConfig().AsValueMap()["additional_location_profile"].AsValueSlice()[0].AsValueMap()["virtual_machine_profile_override"].AsValueSlice()[0].AsValueMap()["os_profile"].AsValueSlice()[0].AsValueMap()["linux_configuration"].AsValueSlice()[0].AsValueMap()["bypass_platform_safety_checks_enabled"]
+ }
+ if !bypassPlatformSafetyChecksEnabledExist.IsNull() || rebootSetting != "" {
+ if patchMode != string(fleets.LinuxVMGuestPatchModeAutomaticByPlatform) {
+ return fmt.Errorf("`bypass_platform_safety_checks_enabled` and `reboot_setting` cannot be set if the `PatchMode` is not `AutomaticByPlatform`")
+ }
+ }
+
+ if input.ExtensionOperationsEnabled && !provisionVMAgentEnabled {
+ return fmt.Errorf("`extension_operations_enabled` cannot be set to `true` when `provision_vm_agent_enabled` is set to `false`")
+ }
+
+ if patchAssessmentMode == string(fleets.WindowsPatchAssessmentModeAutomaticByPlatform) && !provisionVMAgentEnabled {
+ return fmt.Errorf("when the `patch_assessment_mode` field is set to %q the `provision_vm_agent_enabled` must always be set to `true`", fleets.LinuxPatchAssessmentModeAutomaticByPlatform)
+ }
+
+ hasHealthExtension := false
+ if v := input.Extension; len(v) > 0 && (v[0].Type == "ApplicationHealthLinux" || v[0].Type == "ApplicationHealthWindows") {
+ hasHealthExtension = true
+ }
+
+ if patchMode == string(fleets.LinuxVMGuestPatchModeAutomaticByPlatform) {
+ if !provisionVMAgentEnabled {
+ return fmt.Errorf("when the `patch_mode` field is set to %q the `provision_vm_agent_enabled` field must always be set to `true`, got %q", patchMode, strconv.FormatBool(provisionVMAgentEnabled))
+ }
+
+ if !hasHealthExtension {
+ return fmt.Errorf("when the `patch_mode` field is set to %q the `extension` field must contain at least one `application health extension`, got 0", patchMode)
+ }
+ }
+
+ if v[0].AdminPassword == "" && v[0].PasswordAuthenticationEnabled {
+ return fmt.Errorf("`admin_password` is required when `password_authentication_enabled` is enabled")
+ }
+ }
+ return nil
+}
+
+func isValidHotPatchSourceImageReference(referenceInput []SourceImageReferenceModel) bool {
+ if len(referenceInput) == 0 {
+ return false
+ }
+ raw := referenceInput[0]
+ pub := raw.Publisher
+ offer := raw.Offer
+ sku := raw.Sku
+
+ if pub == "MicrosoftWindowsServer" && offer == "WindowsServer" && (sku == "2022-datacenter-azure-edition-core" || sku == "2022-datacenter-azure-edition-core-smalldisk" || sku == "2022-datacenter-azure-edition-hotpatch" || sku == "2022-datacenter-azure-edition-hotpatch-smalldisk") {
+ return true
+ }
+
+ return false
+}
+
+func expandOsProfileLinuxSecretsModel(inputList []LinuxSecretModel) *[]fleets.VaultSecretGroup {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.VaultSecretGroup, 0)
+ for _, v := range inputList {
+ output := fleets.VaultSecretGroup{
+ SourceVault: expandSubResource(v.KeyVaultId),
+ }
+
+ if len(v.Certificate) > 0 {
+ vcs := make([]fleets.VaultCertificate, 0)
+ for _, v := range v.Certificate {
+ vc := fleets.VaultCertificate{}
+ if v.Url != "" {
+ vc.CertificateURL = pointer.To(v.Url)
+ vcs = append(vcs, vc)
+ }
+ }
+ output.VaultCertificates = &vcs
+ }
+
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandOsProfileWindowsSecretsModel(inputList []WindowsSecretModel) *[]fleets.VaultSecretGroup {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.VaultSecretGroup, 0)
+ for _, v := range inputList {
+ output := fleets.VaultSecretGroup{
+ SourceVault: expandSubResource(v.KeyVaultId),
+ }
+
+ if len(v.Certificate) > 0 {
+ vcs := make([]fleets.VaultCertificate, 0)
+ for _, v := range v.Certificate {
+ vc := fleets.VaultCertificate{}
+ if v.Store != "" {
+ vc.CertificateStore = pointer.To(v.Store)
+ }
+ if v.Url != "" {
+ vc.CertificateURL = pointer.To(v.Url)
+ }
+ vcs = append(vcs, vc)
+ }
+
+ output.VaultCertificates = &vcs
+ }
+
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandAdditionalUnAttendContentModel(inputList []AdditionalUnattendContentModel) *[]fleets.AdditionalUnattendContent {
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ outputList := make([]fleets.AdditionalUnattendContent, 0)
+ for _, v := range inputList {
+ input := v
+ output := fleets.AdditionalUnattendContent{
+ SettingName: pointer.To(fleets.SettingNames(input.Setting)),
+ Content: pointer.To(input.Content),
+
+ // no other possible values
+ ComponentName: pointer.To(fleets.ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup),
+ PassName: pointer.To(fleets.PassNameOobeSystem),
+ }
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandDataDiskModel(inputList []DataDiskModel) *[]fleets.VirtualMachineScaleSetDataDisk {
+ outputList := make([]fleets.VirtualMachineScaleSetDataDisk, 0)
+ for _, input := range inputList {
+ output := fleets.VirtualMachineScaleSetDataDisk{
+ CreateOption: fleets.DiskCreateOptionTypes(input.CreateOption),
+ Lun: input.Lun,
+ WriteAcceleratorEnabled: pointer.To(input.WriteAcceleratorEnabled),
+ }
+
+ if input.DeleteOption != "" {
+ output.DeleteOption = pointer.To(fleets.DiskDeleteOptionTypes(input.DeleteOption))
+ }
+
+ if input.DiskSizeInGB > 0 {
+ output.DiskSizeGB = pointer.To(input.DiskSizeInGB)
+ }
+
+ caching := string(fleets.CachingTypesNone)
+ if input.Caching != "" {
+ caching = input.Caching
+ }
+ output.Caching = pointer.To(fleets.CachingTypes(caching))
+
+ if input.StorageAccountType != "" {
+ output.ManagedDisk = &fleets.VirtualMachineScaleSetManagedDiskParameters{
+ StorageAccountType: pointer.To(fleets.StorageAccountTypes(input.StorageAccountType)),
+ }
+ }
+
+ if input.DiskEncryptionSetId != "" {
+ if output.ManagedDisk == nil {
+ output.ManagedDisk = &fleets.VirtualMachineScaleSetManagedDiskParameters{}
+ }
+ output.ManagedDisk.DiskEncryptionSet = &fleets.DiskEncryptionSetParameters{
+ Id: pointer.To(input.DiskEncryptionSetId),
+ }
+ }
+
+ outputList = append(outputList, output)
+ }
+ return &outputList
+}
+
+func expandImageReference(inputList []SourceImageReferenceModel, imageId string) *fleets.ImageReference {
+ if imageId != "" {
+ // With Version : "/communityGalleries/publicGalleryName/images/myGalleryImageName/versions/(major.minor.patch | latest)"
+ // Versionless(e.g. latest): "/communityGalleries/publicGalleryName/images/myGalleryImageName"
+ if _, errors := validation.Any(computeValidate.CommunityGalleryImageID, computeValidate.CommunityGalleryImageVersionID)(imageId, "source_image_id"); len(errors) == 0 {
+ return &fleets.ImageReference{
+ CommunityGalleryImageId: pointer.To(imageId),
+ }
+ }
+
+ // Shared Image Gallery with Cross-Tenant Sharing
+ // With Version : "/sharedGalleries/galleryUniqueName/images/myGalleryImageName/versions/(major.minor.patch | latest)"
+ // Versionless(e.g. latest): "/sharedGalleries/galleryUniqueName/images/myGalleryImageName"
+ if _, errors := validation.Any(computeValidate.SharedGalleryImageID, computeValidate.SharedGalleryImageVersionID)(imageId, "source_image_id"); len(errors) == 0 {
+ return &fleets.ImageReference{
+ SharedGalleryImageId: pointer.To(imageId),
+ }
+ }
+
+ return &fleets.ImageReference{
+ // Standard Shared Image ID: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersion}
+ // Standard Image ID: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}
+ Id: pointer.To(imageId),
+ }
+ }
+
+ if len(inputList) == 0 {
+ return nil
+ }
+
+ input := &inputList[0]
+ return &fleets.ImageReference{
+ Publisher: pointer.To(input.Publisher),
+ Offer: pointer.To(input.Offer),
+ Sku: pointer.To(input.Sku),
+ Version: pointer.To(input.Version),
+ }
+}
+
+func expandOSDiskModel(input *VirtualMachineProfileModel, withVMAttributes bool, isAdditional bool) *fleets.VirtualMachineScaleSetOSDisk {
+ osType := fleets.OperatingSystemTypesLinux
+ if len(input.OsProfile) > 0 && len(input.OsProfile[0].WindowsConfiguration) > 0 {
+ osType = fleets.OperatingSystemTypesWindows
+ }
+
+ if input == nil || len(input.OsDisk) == 0 {
+ // For base VMSS, when `os_disk` is not specified and `vm_attributes` is specified, `OsType` and `CreateOption` are required
+ if withVMAttributes && !isAdditional {
+ return &fleets.VirtualMachineScaleSetOSDisk{
+ OsType: pointer.To(osType),
+ // these have to be hard-coded so there's no point exposing them
+ CreateOption: fleets.DiskCreateOptionTypesFromImage,
+ }
+ }
+ return nil
+ }
+
+ inputOsDisk := &input.OsDisk[0]
+ output := fleets.VirtualMachineScaleSetOSDisk{
+ DeleteOption: pointer.To(fleets.DiskDeleteOptionTypes(inputOsDisk.DeleteOption)),
+ OsType: pointer.To(osType),
+ WriteAcceleratorEnabled: pointer.To(inputOsDisk.WriteAcceleratorEnabled),
+ ManagedDisk: &fleets.VirtualMachineScaleSetManagedDiskParameters{
+ StorageAccountType: pointer.To(fleets.StorageAccountTypes(inputOsDisk.StorageAccountType)),
+ },
+ // these have to be hard-coded so there's no point exposing them
+ CreateOption: fleets.DiskCreateOptionTypesFromImage,
+ }
+
+ if inputOsDisk != nil {
+ if inputOsDisk.DiffDiskOption != "" {
+ output.DiffDiskSettings = &fleets.DiffDiskSettings{
+ Option: pointer.To(fleets.DiffDiskOptions(inputOsDisk.DiffDiskOption)),
+ }
+ }
+
+ if inputOsDisk.DiffDiskPlacement != "" {
+ if output.DiffDiskSettings == nil {
+ output.DiffDiskSettings = &fleets.DiffDiskSettings{}
+ }
+ output.DiffDiskSettings.Placement = pointer.To(fleets.DiffDiskPlacement(inputOsDisk.DiffDiskPlacement))
+ }
+ }
+
+ if inputOsDisk.DiskSizeInGB > 0 {
+ output.DiskSizeGB = pointer.To(inputOsDisk.DiskSizeInGB)
+ }
+
+ caching := fleets.CachingTypesNone
+ if v := inputOsDisk.Caching; v != "" {
+ caching = fleets.CachingTypes(v)
+ }
+ output.Caching = pointer.To(caching)
+
+ if inputOsDisk.DiskEncryptionSetId != "" {
+ output.ManagedDisk.DiskEncryptionSet = &fleets.DiskEncryptionSetParameters{
+ Id: pointer.To(inputOsDisk.DiskEncryptionSetId),
+ }
+ }
+
+ if inputOsDisk.SecurityEncryptionType != "" {
+ output.ManagedDisk.SecurityProfile = &fleets.VMDiskSecurityProfile{
+ SecurityEncryptionType: pointer.To(fleets.SecurityEncryptionTypes(inputOsDisk.SecurityEncryptionType)),
+ }
+ }
+
+ return &output
+}
+
+func flattenVirtualMachineProfileModel(input *fleets.BaseVirtualMachineProfile, metadata sdk.ResourceMetaData, isAdditional bool) ([]VirtualMachineProfileModel, error) {
+ outputList := make([]VirtualMachineProfileModel, 0)
+ if input == nil {
+ return outputList, nil
+ }
+ output := VirtualMachineProfileModel{
+ GalleryApplicationProfile: flattenApplicationProfileModel(input.ApplicationProfile),
+ NetworkInterface: flattenNetworkInterfaceModel(input.NetworkProfile),
+ }
+
+ if v := input.NetworkProfile; v != nil {
+ output.NetworkApiVersion = string(pointer.From(v.NetworkApiVersion))
+ }
+ if v := input.SecurityProfile; v != nil {
+ output.EncryptionAtHostEnabled = pointer.From(v.EncryptionAtHost)
+ if v.UefiSettings != nil {
+ output.SecureBootEnabled = pointer.From(v.UefiSettings.SecureBootEnabled)
+ output.VTpmEnabled = pointer.From(v.UefiSettings.VTpmEnabled)
+ }
+ }
+
+ if v := input.OsProfile; v != nil {
+ osProfile, err := flattenOSProfileModel(v, metadata.ResourceData, isAdditional)
+ if err != nil {
+ return outputList, err
+ }
+ output.OsProfile = osProfile
+ output.ExtensionOperationsEnabled = pointer.From(v.AllowExtensionOperations)
+ }
+
+ if v := input.StorageProfile; v != nil {
+ output.DataDisks = flattenDataDiskModel(v.DataDisks)
+ storageImageId := ""
+ if v.ImageReference != nil {
+ if v.ImageReference.Id != nil {
+ storageImageId = pointer.From(v.ImageReference.Id)
+ }
+ if v.ImageReference.CommunityGalleryImageId != nil {
+ storageImageId = *v.ImageReference.CommunityGalleryImageId
+ }
+ if v.ImageReference.SharedGalleryImageId != nil {
+ storageImageId = *v.ImageReference.SharedGalleryImageId
+ }
+ }
+ output.SourceImageId = storageImageId
+ output.SourceImageReference = flattenImageReference(v.ImageReference, storageImageId != "")
+ output.OsDisk = flattenOSDiskModel(v.OsDisk)
+ }
+
+ if se := input.ScheduledEventsProfile; se != nil {
+ if v := se.TerminateNotificationProfile; v != nil {
+ output.ScheduledEventTerminationTimeout = pointer.From(v.NotBeforeTimeout)
+ }
+ if v := se.OsImageNotificationProfile; v != nil {
+ output.ScheduledEventOsImageTimeout = pointer.From(v.NotBeforeTimeout)
+ }
+ }
+
+ if cr := input.CapacityReservation; cr != nil {
+ if v := cr.CapacityReservationGroup; v != nil {
+ output.CapacityReservationGroupId = pointer.From(v.Id)
+ }
+ }
+
+ if dp := input.DiagnosticsProfile; dp != nil {
+ if v := dp.BootDiagnostics; v != nil {
+ output.BootDiagnosticEnabled = pointer.From(v.Enabled)
+ output.BootDiagnosticStorageAccountEndpoint = pointer.From(v.StorageUri)
+ }
+ }
+
+ extensionProfileValue, err := flattenExtensionModel(input.ExtensionProfile, metadata, isAdditional)
+ if err != nil {
+ return nil, err
+ }
+ output.Extension = extensionProfileValue
+ if input.ExtensionProfile != nil {
+ output.ExtensionsTimeBudget = pointer.From(input.ExtensionProfile.ExtensionsTimeBudget)
+ }
+
+ licenseType := ""
+ if v := pointer.From(input.LicenseType); v != "None" {
+ licenseType = v
+ }
+ output.LicenseType = licenseType
+
+ if input.UserData != nil {
+ output.UserDataBase64 = *input.UserData
+ }
+
+ return append(outputList, output), nil
+}
+
+func flattenAdminSshKeyModel(input *fleets.SshConfiguration) ([]string, error) {
+ outputList := make([]string, 0)
+ if input == nil || input.PublicKeys == nil {
+ return outputList, nil
+ }
+
+ for _, input := range *input.PublicKeys {
+ username := parseUsernameFromAuthorizedKeysPath(*input.Path)
+ if username == nil {
+ return nil, fmt.Errorf("parsing username from %q", pointer.From(input.Path))
+ }
+ outputList = append(outputList, pointer.From(input.KeyData))
+ }
+
+ return outputList, nil
+}
+
+func parseUsernameFromAuthorizedKeysPath(input string) *string {
+ // the Azure VM agent hard-codes this to `/home/username/.ssh/authorized_keys`
+ // as such we can hard-code this for a better UX
+ r := regexp.MustCompile("(/home/)+(?P.*?)(/.ssh/authorized_keys)+")
+
+ keys := r.SubexpNames()
+ values := r.FindStringSubmatch(input)
+
+ if values == nil {
+ return nil
+ }
+
+ for i, k := range keys {
+ if k == "username" {
+ value := values[i]
+ return &value
+ }
+ }
+
+ return nil
+}
+
+func flattenApplicationProfileModel(input *fleets.ApplicationProfile) []GalleryApplicationModel {
+ outputList := make([]GalleryApplicationModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ for _, input := range *input.GalleryApplications {
+ output := GalleryApplicationModel{}
+ output.VersionId = input.PackageReferenceId
+ output.ConfigurationBlobUri = pointer.From(input.ConfigurationReference)
+ output.AutomaticUpgradeEnabled = pointer.From(input.EnableAutomaticUpgrade)
+ output.Order = pointer.From(input.Order)
+ output.Tag = pointer.From(input.Tags)
+ output.TreatFailureAsDeploymentFailureEnabled = pointer.From(input.TreatFailureAsDeploymentFailure)
+
+ outputList = append(outputList, output)
+ }
+
+ return outputList
+}
+
+func flattenNetworkInterfaceModel(input *fleets.VirtualMachineScaleSetNetworkProfile) []NetworkInterfaceModel {
+ outputList := make([]NetworkInterfaceModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ for _, input := range *input.NetworkInterfaceConfigurations {
+ output := NetworkInterfaceModel{
+ Name: input.Name,
+ }
+
+ if props := input.Properties; props != nil {
+ if v := props.AuxiliaryMode; v != nil && *v != fleets.NetworkInterfaceAuxiliaryModeNone {
+ output.AuxiliaryMode = string(*v)
+ }
+
+ if v := props.AuxiliarySku; v != nil && *v != fleets.NetworkInterfaceAuxiliarySkuNone {
+ output.AuxiliarySku = string(*v)
+ }
+
+ output.DeleteOption = string(pointer.From(props.DeleteOption))
+
+ if v := props.DnsSettings; v != nil {
+ output.DnsServers = pointer.From(v.DnsServers)
+ }
+
+ output.AcceleratedNetworkingEnabled = pointer.From(props.EnableAcceleratedNetworking)
+
+ output.IPForwardingEnabled = pointer.From(props.EnableIPForwarding)
+
+ output.IPConfiguration = flattenIPConfigurationModel(props.IPConfigurations)
+
+ if v := props.NetworkSecurityGroup; v != nil {
+ output.NetworkSecurityGroupId = pointer.From(v.Id)
+ }
+
+ output.Primary = pointer.From(props.Primary)
+ }
+
+ outputList = append(outputList, output)
+ }
+
+ return outputList
+}
+
+func flattenOsProfileLinuxSecretsModel(inputList *[]fleets.VaultSecretGroup) []LinuxSecretModel {
+ outputList := make([]LinuxSecretModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+ for _, input := range *inputList {
+ output := LinuxSecretModel{
+ Certificate: flattenLinuxVaultCertificateModel(input.VaultCertificates),
+ }
+ if v := input.SourceVault; v != nil {
+ output.KeyVaultId = pointer.From(v.Id)
+ }
+
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenOsProfileWindowsSecretsModel(inputList *[]fleets.VaultSecretGroup) []WindowsSecretModel {
+ outputList := make([]WindowsSecretModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+ for _, input := range *inputList {
+ output := WindowsSecretModel{
+ Certificate: flattenWindowsVaultCertificateModel(input.VaultCertificates),
+ }
+ if v := input.SourceVault; v != nil {
+ output.KeyVaultId = pointer.From(v.Id)
+ }
+
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenOSProfileModel(input *fleets.VirtualMachineScaleSetOSProfile, d *schema.ResourceData, isAdditional bool) ([]OSProfileModel, error) {
+ outputList := make([]OSProfileModel, 0)
+ if input == nil {
+ return outputList, nil
+ }
+
+ output := OSProfileModel{}
+ if input.CustomData != nil {
+ output.CustomDataBase64 = pointer.From(input.CustomData)
+ } else {
+ if isAdditional {
+ output.CustomDataBase64 = utils.Base64EncodeIfNot(d.Get("additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.custom_data_base64").(string))
+ } else {
+ output.CustomDataBase64 = utils.Base64EncodeIfNot(d.Get("virtual_machine_profile.0.os_profile.0.custom_data_base64").(string))
+ }
+ }
+
+ windowsConfigs := make([]WindowsConfigurationModel, 0)
+ if v := input.WindowsConfiguration; v != nil {
+ windowsConfig := WindowsConfigurationModel{
+ AdditionalUnattendContent: flattenAdditionalUnAttendContentModel(v.AdditionalUnattendContent, d, isAdditional),
+ WinRM: flattenWinRMModel(v.WinRM),
+ AdminUsername: pointer.From(input.AdminUsername),
+ AutomaticUpdatesEnabled: pointer.From(v.EnableAutomaticUpdates),
+ ComputerNamePrefix: pointer.From(input.ComputerNamePrefix),
+ VMAgentPlatformUpdatesEnabled: pointer.From(v.EnableVMAgentPlatformUpdates),
+ ProvisionVMAgentEnabled: pointer.From(v.ProvisionVMAgent),
+ TimeZone: pointer.From(v.TimeZone),
+ Secret: flattenOsProfileWindowsSecretsModel(input.Secrets),
+ }
+ if isAdditional {
+ windowsConfig.AdminPassword = d.Get("additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.admin_password").(string)
+ } else {
+ windowsConfig.AdminPassword = d.Get("virtual_machine_profile.0.os_profile.0.windows_configuration.0.admin_password").(string)
+ }
+
+ if p := v.PatchSettings; p != nil {
+ windowsConfig.PatchMode = string(pointer.From(p.PatchMode))
+ windowsConfig.PatchAssessmentMode = string(pointer.From(p.AssessmentMode))
+ if a := p.AutomaticByPlatformSettings; a != nil {
+ windowsConfig.BypassPlatformSafetyChecksEnabled = pointer.From(a.BypassPlatformSafetyChecksOnUserSchedule)
+ windowsConfig.RebootSetting = string(pointer.From(a.RebootSetting))
+ }
+ windowsConfig.HotPatchingEnabled = pointer.From(p.EnableHotpatching)
+ }
+ windowsConfigs = append(windowsConfigs, windowsConfig)
+ }
+ output.WindowsConfiguration = windowsConfigs
+
+ linuxConfigs := make([]LinuxConfigurationModel, 0)
+ if v := input.LinuxConfiguration; v != nil {
+ linuxConfig := LinuxConfigurationModel{
+ AdminUsername: pointer.From(input.AdminUsername),
+ ComputerNamePrefix: pointer.From(input.ComputerNamePrefix),
+ PasswordAuthenticationEnabled: !pointer.From(v.DisablePasswordAuthentication),
+ VMAgentPlatformUpdatesEnabled: pointer.From(v.EnableVMAgentPlatformUpdates),
+ ProvisionVMAgentEnabled: pointer.From(v.ProvisionVMAgent),
+ Secret: flattenOsProfileLinuxSecretsModel(input.Secrets),
+ }
+
+ if isAdditional {
+ linuxConfig.AdminPassword = d.Get("additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.linux_configuration.0.admin_password").(string)
+ } else {
+ linuxConfig.AdminPassword = d.Get("virtual_machine_profile.0.os_profile.0.linux_configuration.0.admin_password").(string)
+ }
+
+ if p := v.PatchSettings; p != nil {
+ linuxConfig.PatchAssessmentMode = string(pointer.From(p.AssessmentMode))
+ linuxConfig.PatchMode = string(pointer.From(p.PatchMode))
+ if a := p.AutomaticByPlatformSettings; a != nil {
+ linuxConfig.BypassPlatformSafetyChecksEnabled = pointer.From(a.BypassPlatformSafetyChecksOnUserSchedule)
+ linuxConfig.RebootSetting = string(pointer.From(a.RebootSetting))
+ }
+ }
+
+ flattenedSSHPublicKeys, err := flattenAdminSshKeyModel(v.Ssh)
+ if err != nil {
+ return nil, fmt.Errorf("flattening `linux_configuration.0.admin_ssh_keys`: %+v", err)
+ }
+ linuxConfig.AdminSSHKeys = flattenedSSHPublicKeys
+
+ linuxConfigs = append(linuxConfigs, linuxConfig)
+ }
+
+ output.LinuxConfiguration = linuxConfigs
+
+ return append(outputList, output), nil
+}
+
+func flattenLinuxVaultCertificateModel(inputList *[]fleets.VaultCertificate) []LinuxCertificateModel {
+ outputList := make([]LinuxCertificateModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+
+ for _, input := range *inputList {
+ output := LinuxCertificateModel{}
+ output.Url = pointer.From(input.CertificateURL)
+
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenWindowsVaultCertificateModel(inputList *[]fleets.VaultCertificate) []WindowsCertificateModel {
+ outputList := make([]WindowsCertificateModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+
+ for _, input := range *inputList {
+ output := WindowsCertificateModel{}
+ output.Store = pointer.From(input.CertificateStore)
+ output.Url = pointer.From(input.CertificateURL)
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenAdditionalUnAttendContentModel(inputList *[]fleets.AdditionalUnattendContent, d *schema.ResourceData, isAdditional bool) []AdditionalUnattendContentModel {
+ outputList := make([]AdditionalUnattendContentModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+ for i, input := range *inputList {
+ output := AdditionalUnattendContentModel{}
+ existing := make([]interface{}, 0)
+ if isAdditional {
+ if v, ok := d.GetOk("additional_location_profile.0.virtual_machine_profile_override.0.os_profile.0.windows_configuration.0.additional_unattend_content"); ok {
+ existing = v.([]interface{})
+ }
+ } else {
+ if v, ok := d.GetOk("virtual_machine_profile.0.os_profile.0.windows_configuration.0.additional_unattend_content"); ok {
+ existing = v.([]interface{})
+ }
+ }
+ // content isn't returned by the API since it's sensitive data so we need to pull from the state file.
+ content := ""
+ if len(existing) > i {
+ existingVal := existing[i]
+ existingRaw, ok := existingVal.(map[string]interface{})
+ if ok {
+ contentRaw, ok := existingRaw["content"]
+ if ok {
+ content = contentRaw.(string)
+ }
+ }
+ }
+ output.Content = content
+ output.Setting = string(pointer.From(input.SettingName))
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenWinRMModel(input *fleets.WinRMConfiguration) []WinRMModel {
+ outputList := make([]WinRMModel, 0)
+ if input == nil || input.Listeners == nil {
+ return outputList
+ }
+
+ for _, input := range *input.Listeners {
+ output := WinRMModel{}
+ output.CertificateUrl = pointer.From(input.CertificateURL)
+ output.Protocol = string(pointer.From(input.Protocol))
+ outputList = append(outputList, output)
+ }
+
+ return outputList
+}
+
+func flattenDataDiskModel(inputList *[]fleets.VirtualMachineScaleSetDataDisk) []DataDiskModel {
+ outputList := make([]DataDiskModel, 0)
+ if inputList == nil {
+ return outputList
+ }
+ for _, input := range *inputList {
+ output := DataDiskModel{
+ CreateOption: string(input.CreateOption),
+ Lun: input.Lun,
+ }
+
+ caching := ""
+ if v := input.Caching; v != nil && *v != fleets.CachingTypesNone {
+ caching = string(*v)
+ }
+ output.Caching = caching
+ output.DeleteOption = string(pointer.From(input.DeleteOption))
+ output.DiskSizeInGB = pointer.From(input.DiskSizeGB)
+ output.WriteAcceleratorEnabled = pointer.From(input.WriteAcceleratorEnabled)
+
+ if md := input.ManagedDisk; md != nil {
+ if v := md.DiskEncryptionSet; v != nil {
+ output.DiskEncryptionSetId = pointer.From(v.Id)
+ }
+ output.StorageAccountType = string(pointer.From(md.StorageAccountType))
+ }
+
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenImageReference(input *fleets.ImageReference, hasImageId bool) []SourceImageReferenceModel {
+ outputList := make([]SourceImageReferenceModel, 0)
+ // since the image id is pulled out as a separate field, if that's set we should return an empty block here
+ if input == nil || hasImageId {
+ return outputList
+ }
+ output := SourceImageReferenceModel{}
+ output.Publisher = pointer.From(input.Publisher)
+ output.Offer = pointer.From(input.Offer)
+ output.Sku = pointer.From(input.Sku)
+ output.Version = pointer.From(input.Version)
+
+ return append(outputList, output)
+}
+
+func flattenOSDiskModel(input *fleets.VirtualMachineScaleSetOSDisk) []OSDiskModel {
+ outputList := make([]OSDiskModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ output := OSDiskModel{}
+ if v := input.DiffDiskSettings; v != nil {
+ output.DiffDiskOption = string(pointer.From(v.Option))
+ output.DiffDiskPlacement = string(pointer.From(v.Placement))
+ }
+
+ caching := ""
+ if v := input.Caching; v != nil && *v != fleets.CachingTypesNone {
+ caching = string(*v)
+ }
+ output.Caching = caching
+
+ output.DeleteOption = string(pointer.From(input.DeleteOption))
+
+ if input.DiskSizeGB != nil {
+ output.DiskSizeInGB = pointer.From(input.DiskSizeGB)
+ }
+
+ if md := input.ManagedDisk; md != nil {
+ if v := md.DiskEncryptionSet; v != nil {
+ output.DiskEncryptionSetId = pointer.From(v.Id)
+ }
+ if sp := md.SecurityProfile; sp != nil {
+ output.SecurityEncryptionType = string(pointer.From(sp.SecurityEncryptionType))
+ }
+ output.StorageAccountType = string(pointer.From(md.StorageAccountType))
+ }
+
+ output.WriteAcceleratorEnabled = pointer.From(input.WriteAcceleratorEnabled)
+
+ return append(outputList, output)
+}
+
+func flattenExtensionModel(input *fleets.VirtualMachineScaleSetExtensionProfile, metadata sdk.ResourceMetaData, isAdditional bool) ([]ExtensionModel, error) {
+ outputList := make([]ExtensionModel, 0)
+ if input == nil || input.Extensions == nil {
+ return outputList, nil
+ }
+
+ for i, input := range *input.Extensions {
+ output := ExtensionModel{}
+ if input.Name != nil {
+ output.Name = pointer.From(input.Name)
+ }
+
+ if props := input.Properties; props != nil {
+ output.Publisher = pointer.From(props.Publisher)
+ output.Type = pointer.From(props.Type)
+ output.TypeHandlerVersion = pointer.From(props.TypeHandlerVersion)
+ output.AutoUpgradeMinorVersionEnabled = pointer.From(props.AutoUpgradeMinorVersion)
+ output.FailureSuppressionEnabled = pointer.From(props.SuppressFailures)
+ output.AutomaticUpgradeEnabled = pointer.From(props.EnableAutomaticUpgrade)
+ output.ForceExtensionExecutionOnChange = pointer.From(props.ForceUpdateTag)
+ // Sensitive data isn't returned, so we get it from config
+ if isAdditional {
+ output.ProtectedSettingsJson = metadata.ResourceData.Get("additional_location_profile.0.virtual_machine_profile_override.0.extension." + strconv.Itoa(i) + ".protected_settings_json").(string)
+ } else {
+ output.ProtectedSettingsJson = metadata.ResourceData.Get("virtual_machine_profile.0.extension." + strconv.Itoa(i) + ".protected_settings_json").(string)
+ }
+ output.ProtectedSettingsFromKeyVault = flattenProtectedSettingsFromKeyVaultModel(props.ProtectedSettingsFromKeyVault)
+ output.ExtensionsToProvisionAfterVmCreation = pointer.From(props.ProvisionAfterExtensions)
+ extSettings := ""
+ if props.Settings != nil {
+ settings, err := json.Marshal(props.Settings)
+ if err != nil {
+ return nil, fmt.Errorf("unmarshaling `settings`: %+v", err)
+ }
+
+ extSettings = string(settings)
+ }
+ output.SettingsJson = extSettings
+ }
+
+ outputList = append(outputList, output)
+ }
+
+ return outputList, nil
+}
+
+func flattenProtectedSettingsFromKeyVaultModel(input *fleets.KeyVaultSecretReference) []ProtectedSettingsFromKeyVaultModel {
+ outputList := make([]ProtectedSettingsFromKeyVaultModel, 0)
+ if input == nil {
+ return outputList
+ }
+
+ output := ProtectedSettingsFromKeyVaultModel{
+ SecretUrl: input.SecretURL,
+ SourceVaultId: pointer.From(input.SourceVault.Id),
+ }
+
+ return append(outputList, output)
+}
+
+func flattenIPConfigurationModel(inputList []fleets.VirtualMachineScaleSetIPConfiguration) []IPConfigurationModel {
+ outputList := make([]IPConfigurationModel, 0)
+ if len(inputList) == 0 {
+ return outputList
+ }
+ for _, input := range inputList {
+ output := IPConfigurationModel{
+ Name: input.Name,
+ }
+ if props := input.Properties; props != nil {
+ output.Primary = pointer.From(props.Primary)
+ output.Version = string(pointer.From(props.PrivateIPAddressVersion))
+
+ addressPools := make([]string, 0)
+ if v := props.ApplicationGatewayBackendAddressPools; v != nil {
+ addressPools = flattenSubResourceId(*v)
+ }
+ output.ApplicationGatewayBackendAddressPoolIds = addressPools
+
+ lbAddressPools := make([]string, 0)
+ if v := props.LoadBalancerBackendAddressPools; v != nil {
+ lbAddressPools = flattenSubResourceId(*v)
+ }
+ output.LoadBalancerBackendAddressPoolIds = lbAddressPools
+
+ groupIds := make([]string, 0)
+ if v := props.ApplicationSecurityGroups; v != nil {
+ groupIds = flattenSubResourceId(*v)
+ }
+ output.ApplicationSecurityGroupIds = groupIds
+
+ if v := props.PublicIPAddressConfiguration; v != nil {
+ output.PublicIPAddress = flattenPublicIPAddressModel(v)
+ }
+
+ if v := props.Subnet; v != nil {
+ output.SubnetId = pointer.From(v.Id)
+ }
+ }
+
+ outputList = append(outputList, output)
+ }
+ return outputList
+}
+
+func flattenPublicIPAddressModel(input *fleets.VirtualMachineScaleSetPublicIPAddressConfiguration) []PublicIPAddressModel {
+ outputList := make([]PublicIPAddressModel, 0)
+ if input == nil {
+ return outputList
+ }
+ output := PublicIPAddressModel{
+ Name: input.Name,
+ }
+
+ if v := input.Sku; v != nil {
+ if v.Name != nil && v.Tier != nil {
+ output.SkuName = fmt.Sprintf("%s_%s", pointer.From(v.Name), pointer.From(v.Tier))
+ }
+ }
+
+ if props := input.Properties; props != nil {
+ output.DeleteOption = string(pointer.From(props.DeleteOption))
+ if v := props.DnsSettings; v != nil {
+ output.DomainNameLabel = v.DomainNameLabel
+ output.DomainNameLabelScope = string(pointer.From(v.DomainNameLabelScope))
+ }
+ output.IdleTimeoutInMinutes = pointer.From(props.IdleTimeoutInMinutes)
+ output.Version = string(pointer.From(props.PublicIPAddressVersion))
+
+ if v := props.IPTags; v != nil {
+ output.IPTag = flattenIPTagModel(v)
+ }
+ }
+ return append(outputList, output)
+}
+
+func validateAdminUsernameLinux(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
+ }
+
+ // **Disallowed values:**
+ invalidUserNames := []string{
+ " ", "abrt", "adm", "admin", "audio", "backup", "bin", "cdrom", "cgred", "console", "crontab", "daemon", "dbus", "dialout", "dip",
+ "disk", "fax", "floppy", "ftp", "fuse", "games", "gnats", "gopher", "haldaemon", "halt", "irc", "kmem", "landscape", "libuuid", "list",
+ "lock", "lp", "mail", "maildrop", "man", "mem", "messagebus", "mlocate", "modem", "netdev", "news", "nfsnobody", "nobody", "nogroup",
+ "ntp", "operator", "oprofile", "plugdev", "polkituser", "postdrop", "postfix", "proxy", "public", "qpidd", "root", "rpc", "rpcuser",
+ "sasl", "saslauth", "shadow", "shutdown", "slocate", "src", "ssh", "sshd", "staff", "stapdev", "stapusr", "sudo", "sync", "sys", "syslog",
+ "tape", "tcpdump", "test", "trusted", "tty", "users", "utempter", "utmp", "uucp", "uuidd", "vcsa", "video", "voice", "wheel", "whoopsie",
+ "www", "www-data", "wwwrun", "xok",
+ }
+
+ for _, str := range invalidUserNames {
+ if strings.EqualFold(v, str) {
+ errors = append(errors, fmt.Errorf("%q can not be one of %s, got %q", key, azure.QuotedStringSlice(invalidUserNames), v))
+ return warnings, errors
+ }
+ }
+
+ if len(v) < 1 || len(v) > 64 {
+ errors = append(errors, fmt.Errorf("%q must be between 1 and 64 characters in length, got %q(%d characters)", key, v, len(v)))
+ return warnings, errors
+ }
+
+ return
+}
+
+func validatePasswordComplexityWindows(input interface{}, key string) (warnings []string, errors []error) {
+ return validatePasswordComplexity(input, key, 8, 123)
+}
+
+func validatePasswordComplexityLinux(input interface{}, key string) (warnings []string, errors []error) {
+ return validatePasswordComplexity(input, key, 6, 72)
+}
+
+func validatePasswordComplexity(input interface{}, key string, min int, max int) (warnings []string, errors []error) {
+ password, ok := input.(string)
+ if !ok {
+ errors = append(errors, fmt.Errorf("expected %q to be a string", key))
+ return warnings, errors
+ }
+
+ complexityMatch := 0
+ re := regexp.MustCompile(`[a-z]{1,}`)
+ if re != nil && re.MatchString(password) {
+ complexityMatch++
+ }
+
+ re = regexp.MustCompile(`[A-Z]{1,}`)
+ if re != nil && re.MatchString(password) {
+ complexityMatch++
+ }
+
+ re = regexp.MustCompile(`[0-9]{1,}`)
+ if re != nil && re.MatchString(password) {
+ complexityMatch++
+ }
+
+ re = regexp.MustCompile(`[\W_]{1,}`)
+ if re != nil && re.MatchString(password) {
+ complexityMatch++
+ }
+
+ if complexityMatch < 3 {
+ errors = append(errors, fmt.Errorf("%q did not meet minimum password complexity requirements. A password must contain at least 3 of the 4 following conditions: a lower case character, a upper case character, a digit and/or a special character. Got %q", key, password))
+ return warnings, errors
+ }
+
+ if len(password) < min || len(password) > max {
+ errors = append(errors, fmt.Errorf("%q must be at least 6 characters long and less than 72 characters long. Got %q(%d characters)", key, password, len(password)))
+ return warnings, errors
+ }
+
+ // NOTE: I realize that some of these will not pass the above complexity checks, but they are in the API so I am checking
+ // the same values that the API is...
+ disallowedValues := []string{
+ "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!",
+ }
+
+ for _, str := range disallowedValues {
+ if password == str {
+ errors = append(errors, fmt.Errorf("%q can not be one of %s, got %q", key, azure.QuotedStringSlice(disallowedValues), password))
+ return warnings, errors
+ }
+ }
+
+ return warnings, errors
+}
+
+func validateAdminUsernameWindows(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
+ }
+
+ // **Disallowed values:**
+ invalidUserNames := []string{
+ " ", "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a",
+ "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server",
+ "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5",
+ }
+
+ for _, str := range invalidUserNames {
+ if strings.EqualFold(v, str) {
+ errors = append(errors, fmt.Errorf("%q can not be one of %v, got %q", key, invalidUserNames, v))
+ return warnings, errors
+ }
+ }
+
+ // Cannot end in "."
+ if strings.HasSuffix(input.(string), ".") {
+ errors = append(errors, fmt.Errorf("%q can not end with a `.`, got %q", key, v))
+ return warnings, errors
+ }
+
+ if len(v) < 1 || len(v) > 20 {
+ errors = append(errors, fmt.Errorf("%q must be between 1 and 20 characters in length, got %q(%d characters)", key, v, len(v)))
+ return warnings, errors
+ }
+
+ return
+}
diff --git a/internal/services/computefleet/registration.go b/internal/services/computefleet/registration.go
new file mode 100644
index 000000000000..009e02704e11
--- /dev/null
+++ b/internal/services/computefleet/registration.go
@@ -0,0 +1,37 @@
+package computefleet
+
+import (
+ "github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
+)
+
+type Registration struct{}
+
+var _ sdk.TypedServiceRegistration = Registration{}
+
+func (r Registration) AssociatedGitHubLabel() string {
+ return "service/compute-fleet"
+}
+
+// Name is the name of this Service
+func (r Registration) Name() string {
+ return "Compute Fleet"
+}
+
+// WebsiteCategories returns a list of categories which can be used for the sidebar
+func (r Registration) WebsiteCategories() []string {
+ return []string{
+ "Compute Fleet",
+ }
+}
+
+// DataSources returns a list of Data Sources supported by this Service
+func (r Registration) DataSources() []sdk.DataSource {
+ return []sdk.DataSource{}
+}
+
+// Resources returns a list of Resources supported by this Service
+func (r Registration) Resources() []sdk.Resource {
+ return []sdk.Resource{
+ ComputeFleetResource{},
+ }
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/README.md
new file mode 100644
index 000000000000..9d7aeb86e4a2
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/README.md
@@ -0,0 +1,134 @@
+
+## `github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets` Documentation
+
+The `fleets` SDK allows for interaction with Azure Resource Manager `azurefleet` (API Version `2024-11-01`).
+
+This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs).
+
+### Import Path
+
+```go
+import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
+import "github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets"
+```
+
+
+### Client Initialization
+
+```go
+client := fleets.NewFleetsClientWithBaseURI("https://management.azure.com")
+client.Client.Authorizer = authorizer
+```
+
+
+### Example Usage: `FleetsClient.CreateOrUpdate`
+
+```go
+ctx := context.TODO()
+id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetName")
+
+payload := fleets.Fleet{
+ // ...
+}
+
+
+if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil {
+ // handle the error
+}
+```
+
+
+### Example Usage: `FleetsClient.Delete`
+
+```go
+ctx := context.TODO()
+id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetName")
+
+if err := client.DeleteThenPoll(ctx, id); err != nil {
+ // handle the error
+}
+```
+
+
+### Example Usage: `FleetsClient.Get`
+
+```go
+ctx := context.TODO()
+id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetName")
+
+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: `FleetsClient.ListByResourceGroup`
+
+```go
+ctx := context.TODO()
+id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group")
+
+// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination
+items, err := client.ListByResourceGroupComplete(ctx, id)
+if err != nil {
+ // handle the error
+}
+for _, item := range items {
+ // do something
+}
+```
+
+
+### Example Usage: `FleetsClient.ListBySubscription`
+
+```go
+ctx := context.TODO()
+id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")
+
+// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination
+items, err := client.ListBySubscriptionComplete(ctx, id)
+if err != nil {
+ // handle the error
+}
+for _, item := range items {
+ // do something
+}
+```
+
+
+### Example Usage: `FleetsClient.ListVirtualMachineScaleSets`
+
+```go
+ctx := context.TODO()
+id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetName")
+
+// alternatively `client.ListVirtualMachineScaleSets(ctx, id)` can be used to do batched pagination
+items, err := client.ListVirtualMachineScaleSetsComplete(ctx, id)
+if err != nil {
+ // handle the error
+}
+for _, item := range items {
+ // do something
+}
+```
+
+
+### Example Usage: `FleetsClient.Update`
+
+```go
+ctx := context.TODO()
+id := fleets.NewFleetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fleetName")
+
+payload := fleets.FleetUpdate{
+ // ...
+}
+
+
+if err := client.UpdateThenPoll(ctx, id, payload); err != nil {
+ // handle the error
+}
+```
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/client.go
new file mode 100644
index 000000000000..212151c25700
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/client.go
@@ -0,0 +1,26 @@
+package fleets
+
+import (
+ "fmt"
+
+ "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
+ sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type FleetsClient struct {
+ Client *resourcemanager.Client
+}
+
+func NewFleetsClientWithBaseURI(sdkApi sdkEnv.Api) (*FleetsClient, error) {
+ client, err := resourcemanager.NewClient(sdkApi, "fleets", defaultApiVersion)
+ if err != nil {
+ return nil, fmt.Errorf("instantiating FleetsClient: %+v", err)
+ }
+
+ return &FleetsClient{
+ Client: client,
+ }, nil
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/constants.go
new file mode 100644
index 000000000000..6cfa0c3758d8
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/constants.go
@@ -0,0 +1,1796 @@
+package fleets
+
+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 AcceleratorManufacturer string
+
+const (
+ AcceleratorManufacturerAMD AcceleratorManufacturer = "AMD"
+ AcceleratorManufacturerNvidia AcceleratorManufacturer = "Nvidia"
+ AcceleratorManufacturerXilinx AcceleratorManufacturer = "Xilinx"
+)
+
+func PossibleValuesForAcceleratorManufacturer() []string {
+ return []string{
+ string(AcceleratorManufacturerAMD),
+ string(AcceleratorManufacturerNvidia),
+ string(AcceleratorManufacturerXilinx),
+ }
+}
+
+func (s *AcceleratorManufacturer) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseAcceleratorManufacturer(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseAcceleratorManufacturer(input string) (*AcceleratorManufacturer, error) {
+ vals := map[string]AcceleratorManufacturer{
+ "amd": AcceleratorManufacturerAMD,
+ "nvidia": AcceleratorManufacturerNvidia,
+ "xilinx": AcceleratorManufacturerXilinx,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := AcceleratorManufacturer(input)
+ return &out, nil
+}
+
+type AcceleratorType string
+
+const (
+ AcceleratorTypeFPGA AcceleratorType = "FPGA"
+ AcceleratorTypeGPU AcceleratorType = "GPU"
+)
+
+func PossibleValuesForAcceleratorType() []string {
+ return []string{
+ string(AcceleratorTypeFPGA),
+ string(AcceleratorTypeGPU),
+ }
+}
+
+func (s *AcceleratorType) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseAcceleratorType(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseAcceleratorType(input string) (*AcceleratorType, error) {
+ vals := map[string]AcceleratorType{
+ "fpga": AcceleratorTypeFPGA,
+ "gpu": AcceleratorTypeGPU,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := AcceleratorType(input)
+ return &out, nil
+}
+
+type ArchitectureType string
+
+const (
+ ArchitectureTypeARMSixFour ArchitectureType = "ARM64"
+ ArchitectureTypeXSixFour ArchitectureType = "X64"
+)
+
+func PossibleValuesForArchitectureType() []string {
+ return []string{
+ string(ArchitectureTypeARMSixFour),
+ string(ArchitectureTypeXSixFour),
+ }
+}
+
+func (s *ArchitectureType) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseArchitectureType(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseArchitectureType(input string) (*ArchitectureType, error) {
+ vals := map[string]ArchitectureType{
+ "arm64": ArchitectureTypeARMSixFour,
+ "x64": ArchitectureTypeXSixFour,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := ArchitectureType(input)
+ return &out, nil
+}
+
+type CPUManufacturer string
+
+const (
+ CPUManufacturerAMD CPUManufacturer = "AMD"
+ CPUManufacturerAmpere CPUManufacturer = "Ampere"
+ CPUManufacturerIntel CPUManufacturer = "Intel"
+ CPUManufacturerMicrosoft CPUManufacturer = "Microsoft"
+)
+
+func PossibleValuesForCPUManufacturer() []string {
+ return []string{
+ string(CPUManufacturerAMD),
+ string(CPUManufacturerAmpere),
+ string(CPUManufacturerIntel),
+ string(CPUManufacturerMicrosoft),
+ }
+}
+
+func (s *CPUManufacturer) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseCPUManufacturer(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseCPUManufacturer(input string) (*CPUManufacturer, error) {
+ vals := map[string]CPUManufacturer{
+ "amd": CPUManufacturerAMD,
+ "ampere": CPUManufacturerAmpere,
+ "intel": CPUManufacturerIntel,
+ "microsoft": CPUManufacturerMicrosoft,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := CPUManufacturer(input)
+ return &out, nil
+}
+
+type CachingTypes string
+
+const (
+ CachingTypesNone CachingTypes = "None"
+ CachingTypesReadOnly CachingTypes = "ReadOnly"
+ CachingTypesReadWrite CachingTypes = "ReadWrite"
+)
+
+func PossibleValuesForCachingTypes() []string {
+ return []string{
+ string(CachingTypesNone),
+ string(CachingTypesReadOnly),
+ string(CachingTypesReadWrite),
+ }
+}
+
+func (s *CachingTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseCachingTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseCachingTypes(input string) (*CachingTypes, error) {
+ vals := map[string]CachingTypes{
+ "none": CachingTypesNone,
+ "readonly": CachingTypesReadOnly,
+ "readwrite": CachingTypesReadWrite,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := CachingTypes(input)
+ return &out, nil
+}
+
+type ComponentName string
+
+const (
+ ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentName = "Microsoft-Windows-Shell-Setup"
+)
+
+func PossibleValuesForComponentName() []string {
+ return []string{
+ string(ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup),
+ }
+}
+
+func (s *ComponentName) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseComponentName(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseComponentName(input string) (*ComponentName, error) {
+ vals := map[string]ComponentName{
+ "microsoft-windows-shell-setup": ComponentNameMicrosoftNegativeWindowsNegativeShellNegativeSetup,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := ComponentName(input)
+ return &out, nil
+}
+
+type DeleteOptions string
+
+const (
+ DeleteOptionsDelete DeleteOptions = "Delete"
+ DeleteOptionsDetach DeleteOptions = "Detach"
+)
+
+func PossibleValuesForDeleteOptions() []string {
+ return []string{
+ string(DeleteOptionsDelete),
+ string(DeleteOptionsDetach),
+ }
+}
+
+func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDeleteOptions(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDeleteOptions(input string) (*DeleteOptions, error) {
+ vals := map[string]DeleteOptions{
+ "delete": DeleteOptionsDelete,
+ "detach": DeleteOptionsDetach,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DeleteOptions(input)
+ return &out, nil
+}
+
+type DiffDiskOptions string
+
+const (
+ DiffDiskOptionsLocal DiffDiskOptions = "Local"
+)
+
+func PossibleValuesForDiffDiskOptions() []string {
+ return []string{
+ string(DiffDiskOptionsLocal),
+ }
+}
+
+func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDiffDiskOptions(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) {
+ vals := map[string]DiffDiskOptions{
+ "local": DiffDiskOptionsLocal,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DiffDiskOptions(input)
+ return &out, nil
+}
+
+type DiffDiskPlacement string
+
+const (
+ DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk"
+ DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk"
+ DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk"
+)
+
+func PossibleValuesForDiffDiskPlacement() []string {
+ return []string{
+ string(DiffDiskPlacementCacheDisk),
+ string(DiffDiskPlacementNVMeDisk),
+ string(DiffDiskPlacementResourceDisk),
+ }
+}
+
+func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDiffDiskPlacement(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) {
+ vals := map[string]DiffDiskPlacement{
+ "cachedisk": DiffDiskPlacementCacheDisk,
+ "nvmedisk": DiffDiskPlacementNVMeDisk,
+ "resourcedisk": DiffDiskPlacementResourceDisk,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DiffDiskPlacement(input)
+ return &out, nil
+}
+
+type DiskControllerTypes string
+
+const (
+ DiskControllerTypesNVMe DiskControllerTypes = "NVMe"
+ DiskControllerTypesSCSI DiskControllerTypes = "SCSI"
+)
+
+func PossibleValuesForDiskControllerTypes() []string {
+ return []string{
+ string(DiskControllerTypesNVMe),
+ string(DiskControllerTypesSCSI),
+ }
+}
+
+func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDiskControllerTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) {
+ vals := map[string]DiskControllerTypes{
+ "nvme": DiskControllerTypesNVMe,
+ "scsi": DiskControllerTypesSCSI,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DiskControllerTypes(input)
+ return &out, nil
+}
+
+type DiskCreateOptionTypes string
+
+const (
+ DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach"
+ DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy"
+ DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty"
+ DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage"
+ DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore"
+)
+
+func PossibleValuesForDiskCreateOptionTypes() []string {
+ return []string{
+ string(DiskCreateOptionTypesAttach),
+ string(DiskCreateOptionTypesCopy),
+ string(DiskCreateOptionTypesEmpty),
+ string(DiskCreateOptionTypesFromImage),
+ string(DiskCreateOptionTypesRestore),
+ }
+}
+
+func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDiskCreateOptionTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) {
+ vals := map[string]DiskCreateOptionTypes{
+ "attach": DiskCreateOptionTypesAttach,
+ "copy": DiskCreateOptionTypesCopy,
+ "empty": DiskCreateOptionTypesEmpty,
+ "fromimage": DiskCreateOptionTypesFromImage,
+ "restore": DiskCreateOptionTypesRestore,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DiskCreateOptionTypes(input)
+ return &out, nil
+}
+
+type DiskDeleteOptionTypes string
+
+const (
+ DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete"
+ DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach"
+)
+
+func PossibleValuesForDiskDeleteOptionTypes() []string {
+ return []string{
+ string(DiskDeleteOptionTypesDelete),
+ string(DiskDeleteOptionTypesDetach),
+ }
+}
+
+func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDiskDeleteOptionTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) {
+ vals := map[string]DiskDeleteOptionTypes{
+ "delete": DiskDeleteOptionTypesDelete,
+ "detach": DiskDeleteOptionTypesDetach,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DiskDeleteOptionTypes(input)
+ return &out, nil
+}
+
+type DomainNameLabelScopeTypes string
+
+const (
+ DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse"
+ DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse"
+ DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse"
+ DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse"
+)
+
+func PossibleValuesForDomainNameLabelScopeTypes() []string {
+ return []string{
+ string(DomainNameLabelScopeTypesNoReuse),
+ string(DomainNameLabelScopeTypesResourceGroupReuse),
+ string(DomainNameLabelScopeTypesSubscriptionReuse),
+ string(DomainNameLabelScopeTypesTenantReuse),
+ }
+}
+
+func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseDomainNameLabelScopeTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) {
+ vals := map[string]DomainNameLabelScopeTypes{
+ "noreuse": DomainNameLabelScopeTypesNoReuse,
+ "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse,
+ "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse,
+ "tenantreuse": DomainNameLabelScopeTypesTenantReuse,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := DomainNameLabelScopeTypes(input)
+ return &out, nil
+}
+
+type EvictionPolicy string
+
+const (
+ EvictionPolicyDeallocate EvictionPolicy = "Deallocate"
+ EvictionPolicyDelete EvictionPolicy = "Delete"
+)
+
+func PossibleValuesForEvictionPolicy() []string {
+ return []string{
+ string(EvictionPolicyDeallocate),
+ string(EvictionPolicyDelete),
+ }
+}
+
+func (s *EvictionPolicy) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseEvictionPolicy(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseEvictionPolicy(input string) (*EvictionPolicy, error) {
+ vals := map[string]EvictionPolicy{
+ "deallocate": EvictionPolicyDeallocate,
+ "delete": EvictionPolicyDelete,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := EvictionPolicy(input)
+ return &out, nil
+}
+
+type IPVersion string
+
+const (
+ IPVersionIPvFour IPVersion = "IPv4"
+ IPVersionIPvSix IPVersion = "IPv6"
+)
+
+func PossibleValuesForIPVersion() []string {
+ return []string{
+ string(IPVersionIPvFour),
+ string(IPVersionIPvSix),
+ }
+}
+
+func (s *IPVersion) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseIPVersion(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseIPVersion(input string) (*IPVersion, error) {
+ vals := map[string]IPVersion{
+ "ipv4": IPVersionIPvFour,
+ "ipv6": IPVersionIPvSix,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := IPVersion(input)
+ return &out, nil
+}
+
+type LinuxPatchAssessmentMode string
+
+const (
+ LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform"
+ LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault"
+)
+
+func PossibleValuesForLinuxPatchAssessmentMode() []string {
+ return []string{
+ string(LinuxPatchAssessmentModeAutomaticByPlatform),
+ string(LinuxPatchAssessmentModeImageDefault),
+ }
+}
+
+func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseLinuxPatchAssessmentMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) {
+ vals := map[string]LinuxPatchAssessmentMode{
+ "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform,
+ "imagedefault": LinuxPatchAssessmentModeImageDefault,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := LinuxPatchAssessmentMode(input)
+ return &out, nil
+}
+
+type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string
+
+const (
+ LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always"
+ LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired"
+ LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never"
+ LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown"
+)
+
+func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string {
+ return []string{
+ string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways),
+ string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired),
+ string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever),
+ string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown),
+ }
+}
+
+func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) {
+ vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{
+ "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways,
+ "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired,
+ "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever,
+ "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input)
+ return &out, nil
+}
+
+type LinuxVMGuestPatchMode string
+
+const (
+ LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform"
+ LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault"
+)
+
+func PossibleValuesForLinuxVMGuestPatchMode() []string {
+ return []string{
+ string(LinuxVMGuestPatchModeAutomaticByPlatform),
+ string(LinuxVMGuestPatchModeImageDefault),
+ }
+}
+
+func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseLinuxVMGuestPatchMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) {
+ vals := map[string]LinuxVMGuestPatchMode{
+ "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform,
+ "imagedefault": LinuxVMGuestPatchModeImageDefault,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := LinuxVMGuestPatchMode(input)
+ return &out, nil
+}
+
+type LocalStorageDiskType string
+
+const (
+ LocalStorageDiskTypeHDD LocalStorageDiskType = "HDD"
+ LocalStorageDiskTypeSSD LocalStorageDiskType = "SSD"
+)
+
+func PossibleValuesForLocalStorageDiskType() []string {
+ return []string{
+ string(LocalStorageDiskTypeHDD),
+ string(LocalStorageDiskTypeSSD),
+ }
+}
+
+func (s *LocalStorageDiskType) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseLocalStorageDiskType(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseLocalStorageDiskType(input string) (*LocalStorageDiskType, error) {
+ vals := map[string]LocalStorageDiskType{
+ "hdd": LocalStorageDiskTypeHDD,
+ "ssd": LocalStorageDiskTypeSSD,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := LocalStorageDiskType(input)
+ return &out, nil
+}
+
+type ManagedServiceIdentityType string
+
+const (
+ ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None"
+ ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned"
+ ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned"
+ ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned"
+)
+
+func PossibleValuesForManagedServiceIdentityType() []string {
+ return []string{
+ string(ManagedServiceIdentityTypeNone),
+ string(ManagedServiceIdentityTypeSystemAssigned),
+ string(ManagedServiceIdentityTypeSystemAssignedUserAssigned),
+ string(ManagedServiceIdentityTypeUserAssigned),
+ }
+}
+
+func (s *ManagedServiceIdentityType) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseManagedServiceIdentityType(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseManagedServiceIdentityType(input string) (*ManagedServiceIdentityType, error) {
+ vals := map[string]ManagedServiceIdentityType{
+ "none": ManagedServiceIdentityTypeNone,
+ "systemassigned": ManagedServiceIdentityTypeSystemAssigned,
+ "systemassigned,userassigned": ManagedServiceIdentityTypeSystemAssignedUserAssigned,
+ "userassigned": ManagedServiceIdentityTypeUserAssigned,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := ManagedServiceIdentityType(input)
+ return &out, nil
+}
+
+type Mode string
+
+const (
+ ModeAudit Mode = "Audit"
+ ModeEnforce Mode = "Enforce"
+)
+
+func PossibleValuesForMode() []string {
+ return []string{
+ string(ModeAudit),
+ string(ModeEnforce),
+ }
+}
+
+func (s *Mode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseMode(input string) (*Mode, error) {
+ vals := map[string]Mode{
+ "audit": ModeAudit,
+ "enforce": ModeEnforce,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := Mode(input)
+ return &out, nil
+}
+
+type NetworkApiVersion string
+
+const (
+ NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01"
+)
+
+func PossibleValuesForNetworkApiVersion() []string {
+ return []string{
+ string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne),
+ }
+}
+
+func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseNetworkApiVersion(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) {
+ vals := map[string]NetworkApiVersion{
+ "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := NetworkApiVersion(input)
+ return &out, nil
+}
+
+type NetworkInterfaceAuxiliaryMode string
+
+const (
+ NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections"
+ NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating"
+ NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None"
+)
+
+func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string {
+ return []string{
+ string(NetworkInterfaceAuxiliaryModeAcceleratedConnections),
+ string(NetworkInterfaceAuxiliaryModeFloating),
+ string(NetworkInterfaceAuxiliaryModeNone),
+ }
+}
+
+func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseNetworkInterfaceAuxiliaryMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) {
+ vals := map[string]NetworkInterfaceAuxiliaryMode{
+ "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections,
+ "floating": NetworkInterfaceAuxiliaryModeFloating,
+ "none": NetworkInterfaceAuxiliaryModeNone,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := NetworkInterfaceAuxiliaryMode(input)
+ return &out, nil
+}
+
+type NetworkInterfaceAuxiliarySku string
+
+const (
+ NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8"
+ NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4"
+ NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1"
+ NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2"
+ NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None"
+)
+
+func PossibleValuesForNetworkInterfaceAuxiliarySku() []string {
+ return []string{
+ string(NetworkInterfaceAuxiliarySkuAEight),
+ string(NetworkInterfaceAuxiliarySkuAFour),
+ string(NetworkInterfaceAuxiliarySkuAOne),
+ string(NetworkInterfaceAuxiliarySkuATwo),
+ string(NetworkInterfaceAuxiliarySkuNone),
+ }
+}
+
+func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseNetworkInterfaceAuxiliarySku(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) {
+ vals := map[string]NetworkInterfaceAuxiliarySku{
+ "a8": NetworkInterfaceAuxiliarySkuAEight,
+ "a4": NetworkInterfaceAuxiliarySkuAFour,
+ "a1": NetworkInterfaceAuxiliarySkuAOne,
+ "a2": NetworkInterfaceAuxiliarySkuATwo,
+ "none": NetworkInterfaceAuxiliarySkuNone,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := NetworkInterfaceAuxiliarySku(input)
+ return &out, nil
+}
+
+type OperatingSystemTypes string
+
+const (
+ OperatingSystemTypesLinux OperatingSystemTypes = "Linux"
+ OperatingSystemTypesWindows OperatingSystemTypes = "Windows"
+)
+
+func PossibleValuesForOperatingSystemTypes() []string {
+ return []string{
+ string(OperatingSystemTypesLinux),
+ string(OperatingSystemTypesWindows),
+ }
+}
+
+func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseOperatingSystemTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) {
+ vals := map[string]OperatingSystemTypes{
+ "linux": OperatingSystemTypesLinux,
+ "windows": OperatingSystemTypesWindows,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := OperatingSystemTypes(input)
+ return &out, nil
+}
+
+type PassName string
+
+const (
+ PassNameOobeSystem PassName = "OobeSystem"
+)
+
+func PossibleValuesForPassName() []string {
+ return []string{
+ string(PassNameOobeSystem),
+ }
+}
+
+func (s *PassName) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parsePassName(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parsePassName(input string) (*PassName, error) {
+ vals := map[string]PassName{
+ "oobesystem": PassNameOobeSystem,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := PassName(input)
+ return &out, nil
+}
+
+type ProtocolTypes string
+
+const (
+ ProtocolTypesHTTP ProtocolTypes = "Http"
+ ProtocolTypesHTTPS ProtocolTypes = "Https"
+)
+
+func PossibleValuesForProtocolTypes() []string {
+ return []string{
+ string(ProtocolTypesHTTP),
+ string(ProtocolTypesHTTPS),
+ }
+}
+
+func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseProtocolTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseProtocolTypes(input string) (*ProtocolTypes, error) {
+ vals := map[string]ProtocolTypes{
+ "http": ProtocolTypesHTTP,
+ "https": ProtocolTypesHTTPS,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := ProtocolTypes(input)
+ return &out, nil
+}
+
+type ProvisioningState string
+
+const (
+ ProvisioningStateCanceled ProvisioningState = "Canceled"
+ ProvisioningStateCreating ProvisioningState = "Creating"
+ ProvisioningStateDeleting ProvisioningState = "Deleting"
+ ProvisioningStateFailed ProvisioningState = "Failed"
+ ProvisioningStateMigrating ProvisioningState = "Migrating"
+ ProvisioningStateSucceeded ProvisioningState = "Succeeded"
+ ProvisioningStateUpdating ProvisioningState = "Updating"
+)
+
+func PossibleValuesForProvisioningState() []string {
+ return []string{
+ string(ProvisioningStateCanceled),
+ string(ProvisioningStateCreating),
+ string(ProvisioningStateDeleting),
+ string(ProvisioningStateFailed),
+ string(ProvisioningStateMigrating),
+ string(ProvisioningStateSucceeded),
+ string(ProvisioningStateUpdating),
+ }
+}
+
+func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseProvisioningState(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseProvisioningState(input string) (*ProvisioningState, error) {
+ vals := map[string]ProvisioningState{
+ "canceled": ProvisioningStateCanceled,
+ "creating": ProvisioningStateCreating,
+ "deleting": ProvisioningStateDeleting,
+ "failed": ProvisioningStateFailed,
+ "migrating": ProvisioningStateMigrating,
+ "succeeded": ProvisioningStateSucceeded,
+ "updating": ProvisioningStateUpdating,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := ProvisioningState(input)
+ return &out, nil
+}
+
+type PublicIPAddressSkuName string
+
+const (
+ PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic"
+ PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard"
+)
+
+func PossibleValuesForPublicIPAddressSkuName() []string {
+ return []string{
+ string(PublicIPAddressSkuNameBasic),
+ string(PublicIPAddressSkuNameStandard),
+ }
+}
+
+func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parsePublicIPAddressSkuName(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) {
+ vals := map[string]PublicIPAddressSkuName{
+ "basic": PublicIPAddressSkuNameBasic,
+ "standard": PublicIPAddressSkuNameStandard,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := PublicIPAddressSkuName(input)
+ return &out, nil
+}
+
+type PublicIPAddressSkuTier string
+
+const (
+ PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global"
+ PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional"
+)
+
+func PossibleValuesForPublicIPAddressSkuTier() []string {
+ return []string{
+ string(PublicIPAddressSkuTierGlobal),
+ string(PublicIPAddressSkuTierRegional),
+ }
+}
+
+func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parsePublicIPAddressSkuTier(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) {
+ vals := map[string]PublicIPAddressSkuTier{
+ "global": PublicIPAddressSkuTierGlobal,
+ "regional": PublicIPAddressSkuTierRegional,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := PublicIPAddressSkuTier(input)
+ return &out, nil
+}
+
+type RegularPriorityAllocationStrategy string
+
+const (
+ RegularPriorityAllocationStrategyLowestPrice RegularPriorityAllocationStrategy = "LowestPrice"
+ RegularPriorityAllocationStrategyPrioritized RegularPriorityAllocationStrategy = "Prioritized"
+)
+
+func PossibleValuesForRegularPriorityAllocationStrategy() []string {
+ return []string{
+ string(RegularPriorityAllocationStrategyLowestPrice),
+ string(RegularPriorityAllocationStrategyPrioritized),
+ }
+}
+
+func (s *RegularPriorityAllocationStrategy) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseRegularPriorityAllocationStrategy(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseRegularPriorityAllocationStrategy(input string) (*RegularPriorityAllocationStrategy, error) {
+ vals := map[string]RegularPriorityAllocationStrategy{
+ "lowestprice": RegularPriorityAllocationStrategyLowestPrice,
+ "prioritized": RegularPriorityAllocationStrategyPrioritized,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := RegularPriorityAllocationStrategy(input)
+ return &out, nil
+}
+
+type SecurityEncryptionTypes string
+
+const (
+ SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState"
+ SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM"
+ SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly"
+)
+
+func PossibleValuesForSecurityEncryptionTypes() []string {
+ return []string{
+ string(SecurityEncryptionTypesDiskWithVMGuestState),
+ string(SecurityEncryptionTypesNonPersistedTPM),
+ string(SecurityEncryptionTypesVMGuestStateOnly),
+ }
+}
+
+func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseSecurityEncryptionTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) {
+ vals := map[string]SecurityEncryptionTypes{
+ "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState,
+ "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM,
+ "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := SecurityEncryptionTypes(input)
+ return &out, nil
+}
+
+type SecurityTypes string
+
+const (
+ SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM"
+ SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch"
+)
+
+func PossibleValuesForSecurityTypes() []string {
+ return []string{
+ string(SecurityTypesConfidentialVM),
+ string(SecurityTypesTrustedLaunch),
+ }
+}
+
+func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseSecurityTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseSecurityTypes(input string) (*SecurityTypes, error) {
+ vals := map[string]SecurityTypes{
+ "confidentialvm": SecurityTypesConfidentialVM,
+ "trustedlaunch": SecurityTypesTrustedLaunch,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := SecurityTypes(input)
+ return &out, nil
+}
+
+type SettingNames string
+
+const (
+ SettingNamesAutoLogon SettingNames = "AutoLogon"
+ SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands"
+)
+
+func PossibleValuesForSettingNames() []string {
+ return []string{
+ string(SettingNamesAutoLogon),
+ string(SettingNamesFirstLogonCommands),
+ }
+}
+
+func (s *SettingNames) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseSettingNames(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseSettingNames(input string) (*SettingNames, error) {
+ vals := map[string]SettingNames{
+ "autologon": SettingNamesAutoLogon,
+ "firstlogoncommands": SettingNamesFirstLogonCommands,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := SettingNames(input)
+ return &out, nil
+}
+
+type SpotAllocationStrategy string
+
+const (
+ SpotAllocationStrategyCapacityOptimized SpotAllocationStrategy = "CapacityOptimized"
+ SpotAllocationStrategyLowestPrice SpotAllocationStrategy = "LowestPrice"
+ SpotAllocationStrategyPriceCapacityOptimized SpotAllocationStrategy = "PriceCapacityOptimized"
+)
+
+func PossibleValuesForSpotAllocationStrategy() []string {
+ return []string{
+ string(SpotAllocationStrategyCapacityOptimized),
+ string(SpotAllocationStrategyLowestPrice),
+ string(SpotAllocationStrategyPriceCapacityOptimized),
+ }
+}
+
+func (s *SpotAllocationStrategy) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseSpotAllocationStrategy(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseSpotAllocationStrategy(input string) (*SpotAllocationStrategy, error) {
+ vals := map[string]SpotAllocationStrategy{
+ "capacityoptimized": SpotAllocationStrategyCapacityOptimized,
+ "lowestprice": SpotAllocationStrategyLowestPrice,
+ "pricecapacityoptimized": SpotAllocationStrategyPriceCapacityOptimized,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := SpotAllocationStrategy(input)
+ return &out, nil
+}
+
+type StorageAccountTypes string
+
+const (
+ StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS"
+ StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS"
+ StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS"
+ StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS"
+ StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS"
+ StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS"
+ StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS"
+)
+
+func PossibleValuesForStorageAccountTypes() []string {
+ return []string{
+ string(StorageAccountTypesPremiumLRS),
+ string(StorageAccountTypesPremiumVTwoLRS),
+ string(StorageAccountTypesPremiumZRS),
+ string(StorageAccountTypesStandardLRS),
+ string(StorageAccountTypesStandardSSDLRS),
+ string(StorageAccountTypesStandardSSDZRS),
+ string(StorageAccountTypesUltraSSDLRS),
+ }
+}
+
+func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseStorageAccountTypes(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) {
+ vals := map[string]StorageAccountTypes{
+ "premium_lrs": StorageAccountTypesPremiumLRS,
+ "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS,
+ "premium_zrs": StorageAccountTypesPremiumZRS,
+ "standard_lrs": StorageAccountTypesStandardLRS,
+ "standardssd_lrs": StorageAccountTypesStandardSSDLRS,
+ "standardssd_zrs": StorageAccountTypesStandardSSDZRS,
+ "ultrassd_lrs": StorageAccountTypesUltraSSDLRS,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := StorageAccountTypes(input)
+ return &out, nil
+}
+
+type VMAttributeSupport string
+
+const (
+ VMAttributeSupportExcluded VMAttributeSupport = "Excluded"
+ VMAttributeSupportIncluded VMAttributeSupport = "Included"
+ VMAttributeSupportRequired VMAttributeSupport = "Required"
+)
+
+func PossibleValuesForVMAttributeSupport() []string {
+ return []string{
+ string(VMAttributeSupportExcluded),
+ string(VMAttributeSupportIncluded),
+ string(VMAttributeSupportRequired),
+ }
+}
+
+func (s *VMAttributeSupport) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseVMAttributeSupport(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseVMAttributeSupport(input string) (*VMAttributeSupport, error) {
+ vals := map[string]VMAttributeSupport{
+ "excluded": VMAttributeSupportExcluded,
+ "included": VMAttributeSupportIncluded,
+ "required": VMAttributeSupportRequired,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := VMAttributeSupport(input)
+ return &out, nil
+}
+
+type VMCategory string
+
+const (
+ VMCategoryComputeOptimized VMCategory = "ComputeOptimized"
+ VMCategoryFpgaAccelerated VMCategory = "FpgaAccelerated"
+ VMCategoryGeneralPurpose VMCategory = "GeneralPurpose"
+ VMCategoryGpuAccelerated VMCategory = "GpuAccelerated"
+ VMCategoryHighPerformanceCompute VMCategory = "HighPerformanceCompute"
+ VMCategoryMemoryOptimized VMCategory = "MemoryOptimized"
+ VMCategoryStorageOptimized VMCategory = "StorageOptimized"
+)
+
+func PossibleValuesForVMCategory() []string {
+ return []string{
+ string(VMCategoryComputeOptimized),
+ string(VMCategoryFpgaAccelerated),
+ string(VMCategoryGeneralPurpose),
+ string(VMCategoryGpuAccelerated),
+ string(VMCategoryHighPerformanceCompute),
+ string(VMCategoryMemoryOptimized),
+ string(VMCategoryStorageOptimized),
+ }
+}
+
+func (s *VMCategory) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseVMCategory(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseVMCategory(input string) (*VMCategory, error) {
+ vals := map[string]VMCategory{
+ "computeoptimized": VMCategoryComputeOptimized,
+ "fpgaaccelerated": VMCategoryFpgaAccelerated,
+ "generalpurpose": VMCategoryGeneralPurpose,
+ "gpuaccelerated": VMCategoryGpuAccelerated,
+ "highperformancecompute": VMCategoryHighPerformanceCompute,
+ "memoryoptimized": VMCategoryMemoryOptimized,
+ "storageoptimized": VMCategoryStorageOptimized,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := VMCategory(input)
+ return &out, nil
+}
+
+type WindowsPatchAssessmentMode string
+
+const (
+ WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform"
+ WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault"
+)
+
+func PossibleValuesForWindowsPatchAssessmentMode() []string {
+ return []string{
+ string(WindowsPatchAssessmentModeAutomaticByPlatform),
+ string(WindowsPatchAssessmentModeImageDefault),
+ }
+}
+
+func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseWindowsPatchAssessmentMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) {
+ vals := map[string]WindowsPatchAssessmentMode{
+ "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform,
+ "imagedefault": WindowsPatchAssessmentModeImageDefault,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := WindowsPatchAssessmentMode(input)
+ return &out, nil
+}
+
+type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string
+
+const (
+ WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always"
+ WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired"
+ WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never"
+ WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown"
+)
+
+func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string {
+ return []string{
+ string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways),
+ string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired),
+ string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever),
+ string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown),
+ }
+}
+
+func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) {
+ vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{
+ "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways,
+ "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired,
+ "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever,
+ "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input)
+ return &out, nil
+}
+
+type WindowsVMGuestPatchMode string
+
+const (
+ WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS"
+ WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform"
+ WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual"
+)
+
+func PossibleValuesForWindowsVMGuestPatchMode() []string {
+ return []string{
+ string(WindowsVMGuestPatchModeAutomaticByOS),
+ string(WindowsVMGuestPatchModeAutomaticByPlatform),
+ string(WindowsVMGuestPatchModeManual),
+ }
+}
+
+func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error {
+ var decoded string
+ if err := json.Unmarshal(bytes, &decoded); err != nil {
+ return fmt.Errorf("unmarshaling: %+v", err)
+ }
+ out, err := parseWindowsVMGuestPatchMode(decoded)
+ if err != nil {
+ return fmt.Errorf("parsing %q: %+v", decoded, err)
+ }
+ *s = *out
+ return nil
+}
+
+func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) {
+ vals := map[string]WindowsVMGuestPatchMode{
+ "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS,
+ "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform,
+ "manual": WindowsVMGuestPatchModeManual,
+ }
+ if v, ok := vals[strings.ToLower(input)]; ok {
+ return &v, nil
+ }
+
+ // otherwise presume it's an undefined value and best-effort it
+ out := WindowsVMGuestPatchMode(input)
+ return &out, nil
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/id_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/id_fleet.go
new file mode 100644
index 000000000000..1983424335c8
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/id_fleet.go
@@ -0,0 +1,130 @@
+package fleets
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+func init() {
+ recaser.RegisterResourceId(&FleetId{})
+}
+
+var _ resourceids.ResourceId = &FleetId{}
+
+// FleetId is a struct representing the Resource ID for a Fleet
+type FleetId struct {
+ SubscriptionId string
+ ResourceGroupName string
+ FleetName string
+}
+
+// NewFleetID returns a new FleetId struct
+func NewFleetID(subscriptionId string, resourceGroupName string, fleetName string) FleetId {
+ return FleetId{
+ SubscriptionId: subscriptionId,
+ ResourceGroupName: resourceGroupName,
+ FleetName: fleetName,
+ }
+}
+
+// ParseFleetID parses 'input' into a FleetId
+func ParseFleetID(input string) (*FleetId, error) {
+ parser := resourceids.NewParserFromResourceIdType(&FleetId{})
+ parsed, err := parser.Parse(input, false)
+ if err != nil {
+ return nil, fmt.Errorf("parsing %q: %+v", input, err)
+ }
+
+ id := FleetId{}
+ if err = id.FromParseResult(*parsed); err != nil {
+ return nil, err
+ }
+
+ return &id, nil
+}
+
+// ParseFleetIDInsensitively parses 'input' case-insensitively into a FleetId
+// note: this method should only be used for API response data and not user input
+func ParseFleetIDInsensitively(input string) (*FleetId, error) {
+ parser := resourceids.NewParserFromResourceIdType(&FleetId{})
+ parsed, err := parser.Parse(input, true)
+ if err != nil {
+ return nil, fmt.Errorf("parsing %q: %+v", input, err)
+ }
+
+ id := FleetId{}
+ if err = id.FromParseResult(*parsed); err != nil {
+ return nil, err
+ }
+
+ return &id, nil
+}
+
+func (id *FleetId) FromParseResult(input resourceids.ParseResult) error {
+ var ok bool
+
+ if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
+ return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input)
+ }
+
+ if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok {
+ return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input)
+ }
+
+ if id.FleetName, ok = input.Parsed["fleetName"]; !ok {
+ return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input)
+ }
+
+ return nil
+}
+
+// ValidateFleetID checks that 'input' can be parsed as a Fleet ID
+func ValidateFleetID(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 := ParseFleetID(v); err != nil {
+ errors = append(errors, err)
+ }
+
+ return
+}
+
+// ID returns the formatted Fleet ID
+func (id FleetId) ID() string {
+ fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureFleet/fleets/%s"
+ return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.FleetName)
+}
+
+// Segments returns a slice of Resource ID Segments which comprise this Fleet ID
+func (id FleetId) 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("staticMicrosoftAzureFleet", "Microsoft.AzureFleet", "Microsoft.AzureFleet"),
+ resourceids.StaticSegment("staticFleets", "fleets", "fleets"),
+ resourceids.UserSpecifiedSegment("fleetName", "fleetName"),
+ }
+}
+
+// String returns a human-readable description of this Fleet ID
+func (id FleetId) String() string {
+ components := []string{
+ fmt.Sprintf("Subscription: %q", id.SubscriptionId),
+ fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
+ fmt.Sprintf("Fleet Name: %q", id.FleetName),
+ }
+ return fmt.Sprintf("Fleet (%s)", strings.Join(components, "\n"))
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_createorupdate.go
new file mode 100644
index 000000000000..059481c57526
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_createorupdate.go
@@ -0,0 +1,75 @@
+package fleets
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+
+ "github.com/hashicorp/go-azure-sdk/sdk/client"
+ "github.com/hashicorp/go-azure-sdk/sdk/client/pollers"
+ "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
+ "github.com/hashicorp/go-azure-sdk/sdk/odata"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type CreateOrUpdateOperationResponse struct {
+ Poller pollers.Poller
+ HttpResponse *http.Response
+ OData *odata.OData
+ Model *Fleet
+}
+
+// CreateOrUpdate ...
+func (c FleetsClient) CreateOrUpdate(ctx context.Context, id FleetId, input Fleet) (result CreateOrUpdateOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusCreated,
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodPut,
+ Path: id.ID(),
+ }
+
+ req, err := c.Client.NewRequest(ctx, opts)
+ if err != nil {
+ return
+ }
+
+ if err = req.Marshal(input); err != nil {
+ return
+ }
+
+ var resp *client.Response
+ resp, err = req.Execute(ctx)
+ if resp != nil {
+ result.OData = resp.OData
+ result.HttpResponse = resp.Response
+ }
+ if err != nil {
+ return
+ }
+
+ result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client)
+ if err != nil {
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed
+func (c FleetsClient) CreateOrUpdateThenPoll(ctx context.Context, id FleetId, input Fleet) error {
+ result, err := c.CreateOrUpdate(ctx, id, input)
+ if err != nil {
+ return fmt.Errorf("performing CreateOrUpdate: %+v", err)
+ }
+
+ if err := result.Poller.PollUntilDone(ctx); err != nil {
+ return fmt.Errorf("polling after CreateOrUpdate: %+v", err)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_delete.go
new file mode 100644
index 000000000000..2af3eb57f179
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_delete.go
@@ -0,0 +1,70 @@
+package fleets
+
+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 FleetsClient) Delete(ctx context.Context, id FleetId) (result DeleteOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusAccepted,
+ http.StatusNoContent,
+ },
+ HttpMethod: http.MethodDelete,
+ Path: id.ID(),
+ }
+
+ req, err := c.Client.NewRequest(ctx, opts)
+ if err != nil {
+ return
+ }
+
+ var resp *client.Response
+ resp, err = req.Execute(ctx)
+ if resp != nil {
+ result.OData = resp.OData
+ result.HttpResponse = resp.Response
+ }
+ if err != nil {
+ return
+ }
+
+ result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client)
+ if err != nil {
+ return
+ }
+
+ return
+}
+
+// DeleteThenPoll performs Delete then polls until it's completed
+func (c FleetsClient) DeleteThenPoll(ctx context.Context, id FleetId) 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/azurefleet/2024-11-01/fleets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_get.go
new file mode 100644
index 000000000000..c45bbd36e112
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_get.go
@@ -0,0 +1,53 @@
+package fleets
+
+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 *Fleet
+}
+
+// Get ...
+func (c FleetsClient) Get(ctx context.Context, id FleetId) (result GetOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodGet,
+ Path: id.ID(),
+ }
+
+ req, err := c.Client.NewRequest(ctx, opts)
+ if err != nil {
+ return
+ }
+
+ var resp *client.Response
+ resp, err = req.Execute(ctx)
+ if resp != nil {
+ result.OData = resp.OData
+ result.HttpResponse = resp.Response
+ }
+ if err != nil {
+ return
+ }
+
+ var model Fleet
+ result.Model = &model
+ if err = resp.Unmarshal(result.Model); err != nil {
+ return
+ }
+
+ return
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbyresourcegroup.go
new file mode 100644
index 000000000000..6dde708b85a2
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbyresourcegroup.go
@@ -0,0 +1,106 @@
+package fleets
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
+ "github.com/hashicorp/go-azure-sdk/sdk/client"
+ "github.com/hashicorp/go-azure-sdk/sdk/odata"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ListByResourceGroupOperationResponse struct {
+ HttpResponse *http.Response
+ OData *odata.OData
+ Model *[]Fleet
+}
+
+type ListByResourceGroupCompleteResult struct {
+ LatestHttpResponse *http.Response
+ Items []Fleet
+}
+
+type ListByResourceGroupCustomPager struct {
+ NextLink *odata.Link `json:"nextLink"`
+}
+
+func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link {
+ defer func() {
+ p.NextLink = nil
+ }()
+
+ return p.NextLink
+}
+
+// ListByResourceGroup ...
+func (c FleetsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodGet,
+ Pager: &ListByResourceGroupCustomPager{},
+ Path: fmt.Sprintf("%s/providers/Microsoft.AzureFleet/fleets", 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 *[]Fleet `json:"value"`
+ }
+ if err = resp.Unmarshal(&values); err != nil {
+ return
+ }
+
+ result.Model = values.Values
+
+ return
+}
+
+// ListByResourceGroupComplete retrieves all the results into a single object
+func (c FleetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) {
+ return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{})
+}
+
+// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate
+func (c FleetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FleetOperationPredicate) (result ListByResourceGroupCompleteResult, err error) {
+ items := make([]Fleet, 0)
+
+ resp, err := c.ListByResourceGroup(ctx, id)
+ if err != nil {
+ result.LatestHttpResponse = resp.HttpResponse
+ err = fmt.Errorf("loading results: %+v", err)
+ return
+ }
+ if resp.Model != nil {
+ for _, v := range *resp.Model {
+ if predicate.Matches(v) {
+ items = append(items, v)
+ }
+ }
+ }
+
+ result = ListByResourceGroupCompleteResult{
+ LatestHttpResponse: resp.HttpResponse,
+ Items: items,
+ }
+ return
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbysubscription.go
new file mode 100644
index 000000000000..ccfc60b2ec7f
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listbysubscription.go
@@ -0,0 +1,106 @@
+package fleets
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
+ "github.com/hashicorp/go-azure-sdk/sdk/client"
+ "github.com/hashicorp/go-azure-sdk/sdk/odata"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ListBySubscriptionOperationResponse struct {
+ HttpResponse *http.Response
+ OData *odata.OData
+ Model *[]Fleet
+}
+
+type ListBySubscriptionCompleteResult struct {
+ LatestHttpResponse *http.Response
+ Items []Fleet
+}
+
+type ListBySubscriptionCustomPager struct {
+ NextLink *odata.Link `json:"nextLink"`
+}
+
+func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link {
+ defer func() {
+ p.NextLink = nil
+ }()
+
+ return p.NextLink
+}
+
+// ListBySubscription ...
+func (c FleetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodGet,
+ Pager: &ListBySubscriptionCustomPager{},
+ Path: fmt.Sprintf("%s/providers/Microsoft.AzureFleet/fleets", 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 *[]Fleet `json:"value"`
+ }
+ if err = resp.Unmarshal(&values); err != nil {
+ return
+ }
+
+ result.Model = values.Values
+
+ return
+}
+
+// ListBySubscriptionComplete retrieves all the results into a single object
+func (c FleetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) {
+ return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FleetOperationPredicate{})
+}
+
+// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate
+func (c FleetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FleetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) {
+ items := make([]Fleet, 0)
+
+ resp, err := c.ListBySubscription(ctx, id)
+ if err != nil {
+ result.LatestHttpResponse = resp.HttpResponse
+ err = fmt.Errorf("loading results: %+v", err)
+ return
+ }
+ if resp.Model != nil {
+ for _, v := range *resp.Model {
+ if predicate.Matches(v) {
+ items = append(items, v)
+ }
+ }
+ }
+
+ result = ListBySubscriptionCompleteResult{
+ LatestHttpResponse: resp.HttpResponse,
+ Items: items,
+ }
+ return
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listvirtualmachinescalesets.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listvirtualmachinescalesets.go
new file mode 100644
index 000000000000..5e043843b9ab
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_listvirtualmachinescalesets.go
@@ -0,0 +1,105 @@
+package fleets
+
+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 ListVirtualMachineScaleSetsOperationResponse struct {
+ HttpResponse *http.Response
+ OData *odata.OData
+ Model *[]VirtualMachineScaleSet
+}
+
+type ListVirtualMachineScaleSetsCompleteResult struct {
+ LatestHttpResponse *http.Response
+ Items []VirtualMachineScaleSet
+}
+
+type ListVirtualMachineScaleSetsCustomPager struct {
+ NextLink *odata.Link `json:"nextLink"`
+}
+
+func (p *ListVirtualMachineScaleSetsCustomPager) NextPageLink() *odata.Link {
+ defer func() {
+ p.NextLink = nil
+ }()
+
+ return p.NextLink
+}
+
+// ListVirtualMachineScaleSets ...
+func (c FleetsClient) ListVirtualMachineScaleSets(ctx context.Context, id FleetId) (result ListVirtualMachineScaleSetsOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodGet,
+ Pager: &ListVirtualMachineScaleSetsCustomPager{},
+ Path: fmt.Sprintf("%s/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"`
+ }
+ if err = resp.Unmarshal(&values); err != nil {
+ return
+ }
+
+ result.Model = values.Values
+
+ return
+}
+
+// ListVirtualMachineScaleSetsComplete retrieves all the results into a single object
+func (c FleetsClient) ListVirtualMachineScaleSetsComplete(ctx context.Context, id FleetId) (ListVirtualMachineScaleSetsCompleteResult, error) {
+ return c.ListVirtualMachineScaleSetsCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{})
+}
+
+// ListVirtualMachineScaleSetsCompleteMatchingPredicate retrieves all the results and then applies the predicate
+func (c FleetsClient) ListVirtualMachineScaleSetsCompleteMatchingPredicate(ctx context.Context, id FleetId, predicate VirtualMachineScaleSetOperationPredicate) (result ListVirtualMachineScaleSetsCompleteResult, err error) {
+ items := make([]VirtualMachineScaleSet, 0)
+
+ resp, err := c.ListVirtualMachineScaleSets(ctx, id)
+ if err != nil {
+ result.LatestHttpResponse = resp.HttpResponse
+ err = fmt.Errorf("loading results: %+v", err)
+ return
+ }
+ if resp.Model != nil {
+ for _, v := range *resp.Model {
+ if predicate.Matches(v) {
+ items = append(items, v)
+ }
+ }
+ }
+
+ result = ListVirtualMachineScaleSetsCompleteResult{
+ LatestHttpResponse: resp.HttpResponse,
+ Items: items,
+ }
+ return
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_update.go
new file mode 100644
index 000000000000..718214ccc697
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/method_update.go
@@ -0,0 +1,75 @@
+package fleets
+
+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 UpdateOperationResponse struct {
+ Poller pollers.Poller
+ HttpResponse *http.Response
+ OData *odata.OData
+ Model *Fleet
+}
+
+// Update ...
+func (c FleetsClient) Update(ctx context.Context, id FleetId, input FleetUpdate) (result UpdateOperationResponse, err error) {
+ opts := client.RequestOptions{
+ ContentType: "application/json; charset=utf-8",
+ ExpectedStatusCodes: []int{
+ http.StatusAccepted,
+ http.StatusOK,
+ },
+ HttpMethod: http.MethodPatch,
+ Path: id.ID(),
+ }
+
+ req, err := c.Client.NewRequest(ctx, opts)
+ if err != nil {
+ return
+ }
+
+ if err = req.Marshal(input); err != nil {
+ return
+ }
+
+ var resp *client.Response
+ resp, err = req.Execute(ctx)
+ if resp != nil {
+ result.OData = resp.OData
+ result.HttpResponse = resp.Response
+ }
+ if err != nil {
+ return
+ }
+
+ result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client)
+ if err != nil {
+ return
+ }
+
+ return
+}
+
+// UpdateThenPoll performs Update then polls until it's completed
+func (c FleetsClient) UpdateThenPoll(ctx context.Context, id FleetId, input FleetUpdate) error {
+ result, err := c.Update(ctx, id, input)
+ if err != nil {
+ return fmt.Errorf("performing Update: %+v", err)
+ }
+
+ if err := result.Poller.PollUntilDone(ctx); err != nil {
+ return fmt.Errorf("polling after Update: %+v", err)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalcapabilities.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalcapabilities.go
new file mode 100644
index 000000000000..aee1361afcfd
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalcapabilities.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type AdditionalCapabilities struct {
+ HibernationEnabled *bool `json:"hibernationEnabled,omitempty"`
+ UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionallocationsprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionallocationsprofile.go
new file mode 100644
index 000000000000..73ee0ef79982
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionallocationsprofile.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type AdditionalLocationsProfile struct {
+ LocationProfiles []LocationProfile `json:"locationProfiles"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalunattendcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalunattendcontent.go
new file mode 100644
index 000000000000..4dbf70b589c4
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_additionalunattendcontent.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type AdditionalUnattendContent struct {
+ ComponentName *ComponentName `json:"componentName,omitempty"`
+ Content *string `json:"content,omitempty"`
+ PassName *PassName `json:"passName,omitempty"`
+ SettingName *SettingNames `json:"settingName,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apientityreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apientityreference.go
new file mode 100644
index 000000000000..ab0a1d78b2e6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apientityreference.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ApiEntityReference struct {
+ Id *string `json:"id,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierror.go
new file mode 100644
index 000000000000..a93a11873c9d
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierror.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ApiError struct {
+ Code *string `json:"code,omitempty"`
+ Details *[]ApiErrorBase `json:"details,omitempty"`
+ Innererror *InnerError `json:"innererror,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Target *string `json:"target,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierrorbase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierrorbase.go
new file mode 100644
index 000000000000..2eb7277fcf8c
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_apierrorbase.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ApiErrorBase struct {
+ Code *string `json:"code,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Target *string `json:"target,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_applicationprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_applicationprofile.go
new file mode 100644
index 000000000000..7fb5f0a76d57
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_applicationprofile.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ApplicationProfile struct {
+ GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_basevirtualmachineprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_basevirtualmachineprofile.go
new file mode 100644
index 000000000000..9af5805638e6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_basevirtualmachineprofile.go
@@ -0,0 +1,40 @@
+package fleets
+
+import (
+ "time"
+
+ "github.com/hashicorp/go-azure-helpers/lang/dates"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type BaseVirtualMachineProfile struct {
+ ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"`
+ CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"`
+ DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
+ ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"`
+ HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"`
+ LicenseType *string `json:"licenseType,omitempty"`
+ NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"`
+ OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"`
+ ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"`
+ SecurityPostureReference *SecurityPostureReference `json:"securityPostureReference,omitempty"`
+ SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
+ ServiceArtifactReference *ServiceArtifactReference `json:"serviceArtifactReference,omitempty"`
+ StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"`
+ TimeCreated *string `json:"timeCreated,omitempty"`
+ UserData *string `json:"userData,omitempty"`
+}
+
+func (o *BaseVirtualMachineProfile) GetTimeCreatedAsTime() (*time.Time, error) {
+ if o.TimeCreated == nil {
+ return nil, nil
+ }
+ return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00")
+}
+
+func (o *BaseVirtualMachineProfile) SetTimeCreatedAsTime(input time.Time) {
+ formatted := input.Format("2006-01-02T15:04:05Z07:00")
+ o.TimeCreated = &formatted
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_bootdiagnostics.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_bootdiagnostics.go
new file mode 100644
index 000000000000..996a16ade1ec
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_bootdiagnostics.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type BootDiagnostics struct {
+ Enabled *bool `json:"enabled,omitempty"`
+ StorageUri *string `json:"storageUri,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_capacityreservationprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_capacityreservationprofile.go
new file mode 100644
index 000000000000..f450e66f0e42
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_capacityreservationprofile.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type CapacityReservationProfile struct {
+ CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_computeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_computeprofile.go
new file mode 100644
index 000000000000..196e09e448ff
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_computeprofile.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ComputeProfile struct {
+ AdditionalVirtualMachineCapabilities *AdditionalCapabilities `json:"additionalVirtualMachineCapabilities,omitempty"`
+ BaseVirtualMachineProfile BaseVirtualMachineProfile `json:"baseVirtualMachineProfile"`
+ ComputeApiVersion *string `json:"computeApiVersion,omitempty"`
+ PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diagnosticsprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diagnosticsprofile.go
new file mode 100644
index 000000000000..65cf8501bc10
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diagnosticsprofile.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type DiagnosticsProfile struct {
+ BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diffdisksettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diffdisksettings.go
new file mode 100644
index 000000000000..9219602e9566
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diffdisksettings.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type DiffDiskSettings struct {
+ Option *DiffDiskOptions `json:"option,omitempty"`
+ Placement *DiffDiskPlacement `json:"placement,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diskencryptionsetparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diskencryptionsetparameters.go
new file mode 100644
index 000000000000..2dc1fa4492b8
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_diskencryptionsetparameters.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type DiskEncryptionSetParameters struct {
+ Id *string `json:"id,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_encryptionidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_encryptionidentity.go
new file mode 100644
index 000000000000..a15e8cf41846
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_encryptionidentity.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type EncryptionIdentity struct {
+ UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleet.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleet.go
new file mode 100644
index 000000000000..d61cc421b508
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleet.go
@@ -0,0 +1,23 @@
+package fleets
+
+import (
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata"
+ "github.com/hashicorp/go-azure-helpers/resourcemanager/zones"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type Fleet struct {
+ Id *string `json:"id,omitempty"`
+ Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"`
+ Location string `json:"location"`
+ Name *string `json:"name,omitempty"`
+ Plan *Plan `json:"plan,omitempty"`
+ Properties *FleetProperties `json:"properties,omitempty"`
+ SystemData *systemdata.SystemData `json:"systemData,omitempty"`
+ Tags *map[string]string `json:"tags,omitempty"`
+ Type *string `json:"type,omitempty"`
+ Zones *zones.Schema `json:"zones,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetproperties.go
new file mode 100644
index 000000000000..8c473f5936c4
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetproperties.go
@@ -0,0 +1,34 @@
+package fleets
+
+import (
+ "time"
+
+ "github.com/hashicorp/go-azure-helpers/lang/dates"
+)
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type FleetProperties struct {
+ AdditionalLocationsProfile *AdditionalLocationsProfile `json:"additionalLocationsProfile,omitempty"`
+ ComputeProfile ComputeProfile `json:"computeProfile"`
+ ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"`
+ RegularPriorityProfile *RegularPriorityProfile `json:"regularPriorityProfile,omitempty"`
+ SpotPriorityProfile *SpotPriorityProfile `json:"spotPriorityProfile,omitempty"`
+ TimeCreated *string `json:"timeCreated,omitempty"`
+ UniqueId *string `json:"uniqueId,omitempty"`
+ VMAttributes *VMAttributes `json:"vmAttributes,omitempty"`
+ VMSizesProfile []VMSizeProfile `json:"vmSizesProfile"`
+}
+
+func (o *FleetProperties) GetTimeCreatedAsTime() (*time.Time, error) {
+ if o.TimeCreated == nil {
+ return nil, nil
+ }
+ return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00")
+}
+
+func (o *FleetProperties) SetTimeCreatedAsTime(input time.Time) {
+ formatted := input.Format("2006-01-02T15:04:05Z07:00")
+ o.TimeCreated = &formatted
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetupdate.go
new file mode 100644
index 000000000000..1da51b98167f
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_fleetupdate.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type FleetUpdate struct {
+ Identity *ManagedServiceIdentityUpdate `json:"identity,omitempty"`
+ Plan *ResourcePlanUpdate `json:"plan,omitempty"`
+ Properties *FleetProperties `json:"properties,omitempty"`
+ Tags *map[string]string `json:"tags,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_imagereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_imagereference.go
new file mode 100644
index 000000000000..c67656bf0ce5
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_imagereference.go
@@ -0,0 +1,15 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ImageReference struct {
+ CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"`
+ ExactVersion *string `json:"exactVersion,omitempty"`
+ Id *string `json:"id,omitempty"`
+ Offer *string `json:"offer,omitempty"`
+ Publisher *string `json:"publisher,omitempty"`
+ SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"`
+ Sku *string `json:"sku,omitempty"`
+ Version *string `json:"version,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_innererror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_innererror.go
new file mode 100644
index 000000000000..9a0ac49f18d9
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_innererror.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type InnerError struct {
+ ErrorDetail *string `json:"errorDetail,omitempty"`
+ ExceptionType *string `json:"exceptionType,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_keyvaultsecretreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_keyvaultsecretreference.go
new file mode 100644
index 000000000000..684b04866424
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_keyvaultsecretreference.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type KeyVaultSecretReference struct {
+ SecretURL string `json:"secretUrl"`
+ SourceVault SubResource `json:"sourceVault"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxconfiguration.go
new file mode 100644
index 000000000000..56deaf78e9d3
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxconfiguration.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type LinuxConfiguration struct {
+ DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"`
+ EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"`
+ PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"`
+ ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"`
+ Ssh *SshConfiguration `json:"ssh,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxpatchsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxpatchsettings.go
new file mode 100644
index 000000000000..718c23e2a8bb
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxpatchsettings.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type LinuxPatchSettings struct {
+ AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"`
+ AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"`
+ PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxvmguestpatchautomaticbyplatformsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxvmguestpatchautomaticbyplatformsettings.go
new file mode 100644
index 000000000000..10b840d5bfae
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_linuxvmguestpatchautomaticbyplatformsettings.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type LinuxVMGuestPatchAutomaticByPlatformSettings struct {
+ BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"`
+ RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_locationprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_locationprofile.go
new file mode 100644
index 000000000000..d3eefbe05b3b
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_locationprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type LocationProfile struct {
+ Location string `json:"location"`
+ VirtualMachineProfileOverride *BaseVirtualMachineProfile `json:"virtualMachineProfileOverride,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_managedserviceidentityupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_managedserviceidentityupdate.go
new file mode 100644
index 000000000000..719bba30d96a
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_managedserviceidentityupdate.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ManagedServiceIdentityUpdate struct {
+ Type *ManagedServiceIdentityType `json:"type,omitempty"`
+ UserAssignedIdentities *map[string]UserAssignedIdentity `json:"userAssignedIdentities,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_osimagenotificationprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_osimagenotificationprofile.go
new file mode 100644
index 000000000000..5e8cb60dee31
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_osimagenotificationprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type OSImageNotificationProfile struct {
+ Enable *bool `json:"enable,omitempty"`
+ NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_patchsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_patchsettings.go
new file mode 100644
index 000000000000..14c8c88e1d06
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_patchsettings.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type PatchSettings struct {
+ AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"`
+ AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"`
+ EnableHotpatching *bool `json:"enableHotpatching,omitempty"`
+ PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_plan.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_plan.go
new file mode 100644
index 000000000000..5f7e1d4e7434
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_plan.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type Plan struct {
+ Name string `json:"name"`
+ Product string `json:"product"`
+ PromotionCode *string `json:"promotionCode,omitempty"`
+ Publisher string `json:"publisher"`
+ Version *string `json:"version,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_proxyagentsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_proxyagentsettings.go
new file mode 100644
index 000000000000..95f7078adfce
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_proxyagentsettings.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ProxyAgentSettings struct {
+ Enabled *bool `json:"enabled,omitempty"`
+ KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"`
+ Mode *Mode `json:"mode,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_publicipaddresssku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_publicipaddresssku.go
new file mode 100644
index 000000000000..dd4a6eb1ea50
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_publicipaddresssku.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type PublicIPAddressSku struct {
+ Name *PublicIPAddressSkuName `json:"name,omitempty"`
+ Tier *PublicIPAddressSkuTier `json:"tier,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_regularpriorityprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_regularpriorityprofile.go
new file mode 100644
index 000000000000..b7e60460b86e
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_regularpriorityprofile.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type RegularPriorityProfile struct {
+ AllocationStrategy *RegularPriorityAllocationStrategy `json:"allocationStrategy,omitempty"`
+ Capacity *int64 `json:"capacity,omitempty"`
+ MinCapacity *int64 `json:"minCapacity,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_resourceplanupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_resourceplanupdate.go
new file mode 100644
index 000000000000..ba98f103d4a1
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_resourceplanupdate.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ResourcePlanUpdate struct {
+ Name *string `json:"name,omitempty"`
+ Product *string `json:"product,omitempty"`
+ PromotionCode *string `json:"promotionCode,omitempty"`
+ Publisher *string `json:"publisher,omitempty"`
+ Version *string `json:"version,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_scheduledeventsprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_scheduledeventsprofile.go
new file mode 100644
index 000000000000..962b353efd27
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_scheduledeventsprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ScheduledEventsProfile struct {
+ OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"`
+ TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityposturereference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityposturereference.go
new file mode 100644
index 000000000000..baa61cd18076
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityposturereference.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SecurityPostureReference struct {
+ ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"`
+ Id *string `json:"id,omitempty"`
+ IsOverridable *bool `json:"isOverridable,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityprofile.go
new file mode 100644
index 000000000000..91e44a21e29b
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_securityprofile.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SecurityProfile struct {
+ EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"`
+ EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"`
+ ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"`
+ SecurityType *SecurityTypes `json:"securityType,omitempty"`
+ UefiSettings *UefiSettings `json:"uefiSettings,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_serviceartifactreference.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_serviceartifactreference.go
new file mode 100644
index 000000000000..b49e9629b4b2
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_serviceartifactreference.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type ServiceArtifactReference struct {
+ Id *string `json:"id,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_spotpriorityprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_spotpriorityprofile.go
new file mode 100644
index 000000000000..f85f4dde4d1e
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_spotpriorityprofile.go
@@ -0,0 +1,13 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SpotPriorityProfile struct {
+ AllocationStrategy *SpotAllocationStrategy `json:"allocationStrategy,omitempty"`
+ Capacity *int64 `json:"capacity,omitempty"`
+ EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"`
+ Maintain *bool `json:"maintain,omitempty"`
+ MaxPricePerVM *float64 `json:"maxPricePerVM,omitempty"`
+ MinCapacity *int64 `json:"minCapacity,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshconfiguration.go
new file mode 100644
index 000000000000..2a22e28e3a2a
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshconfiguration.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SshConfiguration struct {
+ PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshpublickey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshpublickey.go
new file mode 100644
index 000000000000..44a2fb49cab6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_sshpublickey.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SshPublicKey struct {
+ KeyData *string `json:"keyData,omitempty"`
+ Path *string `json:"path,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_subresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_subresource.go
new file mode 100644
index 000000000000..56bd148f4274
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_subresource.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type SubResource struct {
+ Id *string `json:"id,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_terminatenotificationprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_terminatenotificationprofile.go
new file mode 100644
index 000000000000..135150fc173a
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_terminatenotificationprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type TerminateNotificationProfile struct {
+ Enable *bool `json:"enable,omitempty"`
+ NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_uefisettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_uefisettings.go
new file mode 100644
index 000000000000..c2a7cf858c3c
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_uefisettings.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type UefiSettings struct {
+ SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"`
+ VTpmEnabled *bool `json:"vTpmEnabled,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_userassignedidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_userassignedidentity.go
new file mode 100644
index 000000000000..a9ceb2d827ec
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_userassignedidentity.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type UserAssignedIdentity struct {
+ ClientId *string `json:"clientId,omitempty"`
+ PrincipalId *string `json:"principalId,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultcertificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultcertificate.go
new file mode 100644
index 000000000000..0cfabd0a8cc2
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultcertificate.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VaultCertificate struct {
+ CertificateStore *string `json:"certificateStore,omitempty"`
+ CertificateURL *string `json:"certificateUrl,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultsecretgroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultsecretgroup.go
new file mode 100644
index 000000000000..0c77cbe3366e
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vaultsecretgroup.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VaultSecretGroup struct {
+ SourceVault *SubResource `json:"sourceVault,omitempty"`
+ VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualharddisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualharddisk.go
new file mode 100644
index 000000000000..377f8c771daa
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualharddisk.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualHardDisk struct {
+ Uri *string `json:"uri,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescaleset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescaleset.go
new file mode 100644
index 000000000000..a2cd9025d1aa
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescaleset.go
@@ -0,0 +1,12 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSet struct {
+ Error *ApiError `json:"error,omitempty"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ OperationStatus ProvisioningState `json:"operationStatus"`
+ Type *string `json:"type,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetdatadisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetdatadisk.go
new file mode 100644
index 000000000000..57a2c2be1dd4
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetdatadisk.go
@@ -0,0 +1,17 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetDataDisk struct {
+ Caching *CachingTypes `json:"caching,omitempty"`
+ CreateOption DiskCreateOptionTypes `json:"createOption"`
+ DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"`
+ DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"`
+ DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"`
+ DiskSizeGB *int64 `json:"diskSizeGB,omitempty"`
+ Lun int64 `json:"lun"`
+ ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"`
+ Name *string `json:"name,omitempty"`
+ WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextension.go
new file mode 100644
index 000000000000..1da320c3231d
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextension.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetExtension struct {
+ Id *string `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"`
+ Type *string `json:"type,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionprofile.go
new file mode 100644
index 000000000000..2f7a0f4306be
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetExtensionProfile struct {
+ Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"`
+ ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionproperties.go
new file mode 100644
index 000000000000..5261f1d1b5ae
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetextensionproperties.go
@@ -0,0 +1,19 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetExtensionProperties struct {
+ AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"`
+ EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"`
+ ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`
+ ProtectedSettings *map[string]interface{} `json:"protectedSettings,omitempty"`
+ ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"`
+ ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"`
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ Publisher *string `json:"publisher,omitempty"`
+ Settings *map[string]interface{} `json:"settings,omitempty"`
+ SuppressFailures *bool `json:"suppressFailures,omitempty"`
+ Type *string `json:"type,omitempty"`
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesethardwareprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesethardwareprofile.go
new file mode 100644
index 000000000000..43769c31c4e9
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesethardwareprofile.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetHardwareProfile struct {
+ VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfiguration.go
new file mode 100644
index 000000000000..890a2f8150bc
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfiguration.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetIPConfiguration struct {
+ Name string `json:"name"`
+ Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfigurationproperties.go
new file mode 100644
index 000000000000..eb0dd8646213
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetipconfigurationproperties.go
@@ -0,0 +1,15 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetIPConfigurationProperties struct {
+ ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"`
+ ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"`
+ LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"`
+ LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"`
+ Primary *bool `json:"primary,omitempty"`
+ PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"`
+ PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"`
+ Subnet *ApiEntityReference `json:"subnet,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetiptag.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetiptag.go
new file mode 100644
index 000000000000..d33842afe8e0
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetiptag.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetIPTag struct {
+ IPTagType *string `json:"ipTagType,omitempty"`
+ Tag *string `json:"tag,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetmanageddiskparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetmanageddiskparameters.go
new file mode 100644
index 000000000000..3c3b31b01528
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetmanageddiskparameters.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetManagedDiskParameters struct {
+ DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"`
+ SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"`
+ StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfiguration.go
new file mode 100644
index 000000000000..bb94e01cc6d9
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfiguration.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetNetworkConfiguration struct {
+ Name string `json:"name"`
+ Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go
new file mode 100644
index 000000000000..6fd867af2be2
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct {
+ DnsServers *[]string `json:"dnsServers,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationproperties.go
new file mode 100644
index 000000000000..e73eca06b6b6
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkconfigurationproperties.go
@@ -0,0 +1,18 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetNetworkConfigurationProperties struct {
+ AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"`
+ AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"`
+ DeleteOption *DeleteOptions `json:"deleteOption,omitempty"`
+ DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"`
+ DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"`
+ EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"`
+ EnableFpga *bool `json:"enableFpga,omitempty"`
+ EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"`
+ IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"`
+ NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"`
+ Primary *bool `json:"primary,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkprofile.go
new file mode 100644
index 000000000000..e0a0045cf803
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetnetworkprofile.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetNetworkProfile struct {
+ HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"`
+ NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"`
+ NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosdisk.go
new file mode 100644
index 000000000000..8c08084f0046
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosdisk.go
@@ -0,0 +1,18 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetOSDisk struct {
+ Caching *CachingTypes `json:"caching,omitempty"`
+ CreateOption DiskCreateOptionTypes `json:"createOption"`
+ DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"`
+ DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"`
+ DiskSizeGB *int64 `json:"diskSizeGB,omitempty"`
+ Image *VirtualHardDisk `json:"image,omitempty"`
+ ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"`
+ Name *string `json:"name,omitempty"`
+ OsType *OperatingSystemTypes `json:"osType,omitempty"`
+ VhdContainers *[]string `json:"vhdContainers,omitempty"`
+ WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosprofile.go
new file mode 100644
index 000000000000..7f4e67b43ec7
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetosprofile.go
@@ -0,0 +1,16 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetOSProfile struct {
+ AdminPassword *string `json:"adminPassword,omitempty"`
+ AdminUsername *string `json:"adminUsername,omitempty"`
+ AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"`
+ ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"`
+ CustomData *string `json:"customData,omitempty"`
+ LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"`
+ RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"`
+ Secrets *[]VaultSecretGroup `json:"secrets,omitempty"`
+ WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfiguration.go
new file mode 100644
index 000000000000..cc74bad9d0e4
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfiguration.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetPublicIPAddressConfiguration struct {
+ Name string `json:"name"`
+ Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"`
+ Sku *PublicIPAddressSku `json:"sku,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go
new file mode 100644
index 000000000000..a8c18f2c5b47
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct {
+ DomainNameLabel string `json:"domainNameLabel"`
+ DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go
new file mode 100644
index 000000000000..11faa5ab0935
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go
@@ -0,0 +1,13 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct {
+ DeleteOption *DeleteOptions `json:"deleteOption,omitempty"`
+ DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"`
+ IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"`
+ IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"`
+ PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"`
+ PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetstorageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetstorageprofile.go
new file mode 100644
index 000000000000..4a8d9f184ca5
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_virtualmachinescalesetstorageprofile.go
@@ -0,0 +1,11 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VirtualMachineScaleSetStorageProfile struct {
+ DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"`
+ DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"`
+ ImageReference *ImageReference `json:"imageReference,omitempty"`
+ OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxdouble.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxdouble.go
new file mode 100644
index 000000000000..978aa4a3b9cf
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxdouble.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMAttributeMinMaxDouble struct {
+ Max *float64 `json:"max,omitempty"`
+ Min *float64 `json:"min,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxinteger.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxinteger.go
new file mode 100644
index 000000000000..7ce95208fb3b
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributeminmaxinteger.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMAttributeMinMaxInteger struct {
+ Max *int64 `json:"max,omitempty"`
+ Min *int64 `json:"min,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributes.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributes.go
new file mode 100644
index 000000000000..734e5277880b
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmattributes.go
@@ -0,0 +1,27 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMAttributes struct {
+ AcceleratorCount *VMAttributeMinMaxInteger `json:"acceleratorCount,omitempty"`
+ AcceleratorManufacturers *[]AcceleratorManufacturer `json:"acceleratorManufacturers,omitempty"`
+ AcceleratorSupport *VMAttributeSupport `json:"acceleratorSupport,omitempty"`
+ AcceleratorTypes *[]AcceleratorType `json:"acceleratorTypes,omitempty"`
+ ArchitectureTypes *[]ArchitectureType `json:"architectureTypes,omitempty"`
+ BurstableSupport *VMAttributeSupport `json:"burstableSupport,omitempty"`
+ CpuManufacturers *[]CPUManufacturer `json:"cpuManufacturers,omitempty"`
+ DataDiskCount *VMAttributeMinMaxInteger `json:"dataDiskCount,omitempty"`
+ ExcludedVMSizes *[]string `json:"excludedVMSizes,omitempty"`
+ LocalStorageDiskTypes *[]LocalStorageDiskType `json:"localStorageDiskTypes,omitempty"`
+ LocalStorageInGiB *VMAttributeMinMaxDouble `json:"localStorageInGiB,omitempty"`
+ LocalStorageSupport *VMAttributeSupport `json:"localStorageSupport,omitempty"`
+ MemoryInGiB VMAttributeMinMaxDouble `json:"memoryInGiB"`
+ MemoryInGiBPerVCPU *VMAttributeMinMaxDouble `json:"memoryInGiBPerVCpu,omitempty"`
+ NetworkBandwidthInMbps *VMAttributeMinMaxDouble `json:"networkBandwidthInMbps,omitempty"`
+ NetworkInterfaceCount *VMAttributeMinMaxInteger `json:"networkInterfaceCount,omitempty"`
+ RdmaNetworkInterfaceCount *VMAttributeMinMaxInteger `json:"rdmaNetworkInterfaceCount,omitempty"`
+ RdmaSupport *VMAttributeSupport `json:"rdmaSupport,omitempty"`
+ VCPUCount VMAttributeMinMaxInteger `json:"vCpuCount"`
+ VMCategories *[]VMCategory `json:"vmCategories,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmdisksecurityprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmdisksecurityprofile.go
new file mode 100644
index 000000000000..8ad4bea61bee
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmdisksecurityprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMDiskSecurityProfile struct {
+ DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"`
+ SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmgalleryapplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmgalleryapplication.go
new file mode 100644
index 000000000000..14410c448f88
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmgalleryapplication.go
@@ -0,0 +1,13 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMGalleryApplication struct {
+ ConfigurationReference *string `json:"configurationReference,omitempty"`
+ EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"`
+ Order *int64 `json:"order,omitempty"`
+ PackageReferenceId string `json:"packageReferenceId"`
+ Tags *string `json:"tags,omitempty"`
+ TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeprofile.go
new file mode 100644
index 000000000000..ff86647b6863
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeprofile.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMSizeProfile struct {
+ Name string `json:"name"`
+ Rank *int64 `json:"rank,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeproperties.go
new file mode 100644
index 000000000000..59621f57f754
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_vmsizeproperties.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type VMSizeProperties struct {
+ VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"`
+ VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsconfiguration.go
new file mode 100644
index 000000000000..74d866389bfc
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsconfiguration.go
@@ -0,0 +1,14 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type WindowsConfiguration struct {
+ AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"`
+ EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"`
+ EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"`
+ PatchSettings *PatchSettings `json:"patchSettings,omitempty"`
+ ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"`
+ TimeZone *string `json:"timeZone,omitempty"`
+ WinRM *WinRMConfiguration `json:"winRM,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsvmguestpatchautomaticbyplatformsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsvmguestpatchautomaticbyplatformsettings.go
new file mode 100644
index 000000000000..60f79c4e492c
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_windowsvmguestpatchautomaticbyplatformsettings.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type WindowsVMGuestPatchAutomaticByPlatformSettings struct {
+ BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"`
+ RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmconfiguration.go
new file mode 100644
index 000000000000..3e0154b4b3b0
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmconfiguration.go
@@ -0,0 +1,8 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type WinRMConfiguration struct {
+ Listeners *[]WinRMListener `json:"listeners,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmlistener.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmlistener.go
new file mode 100644
index 000000000000..67a7c3aa0daa
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/model_winrmlistener.go
@@ -0,0 +1,9 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type WinRMListener struct {
+ CertificateURL *string `json:"certificateUrl,omitempty"`
+ Protocol *ProtocolTypes `json:"protocol,omitempty"`
+}
diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/predicates.go
new file mode 100644
index 000000000000..2cf769e96ae4
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/predicates.go
@@ -0,0 +1,55 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+type FleetOperationPredicate struct {
+ Id *string
+ Location *string
+ Name *string
+ Type *string
+}
+
+func (p FleetOperationPredicate) Matches(input Fleet) bool {
+
+ if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) {
+ return false
+ }
+
+ if p.Location != nil && *p.Location != input.Location {
+ return false
+ }
+
+ if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) {
+ return false
+ }
+
+ if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) {
+ return false
+ }
+
+ return true
+}
+
+type VirtualMachineScaleSetOperationPredicate struct {
+ Id *string
+ Name *string
+ Type *string
+}
+
+func (p VirtualMachineScaleSetOperationPredicate) Matches(input VirtualMachineScaleSet) bool {
+
+ if p.Id != nil && *p.Id != input.Id {
+ return false
+ }
+
+ if p.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/azurefleet/2024-11-01/fleets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/version.go
new file mode 100644
index 000000000000..554a3ac9b69e
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets/version.go
@@ -0,0 +1,10 @@
+package fleets
+
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
+
+const defaultApiVersion = "2024-11-01"
+
+func userAgent() string {
+ return "hashicorp/go-azure-sdk/fleets/2024-11-01"
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 3fe1e4472e64..2a13c8b5d9b9 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -277,6 +277,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/automation/2023-11-01/typefie
github.com/hashicorp/go-azure-sdk/resource-manager/automation/2023-11-01/usages
github.com/hashicorp/go-azure-sdk/resource-manager/automation/2023-11-01/variable
github.com/hashicorp/go-azure-sdk/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings
+github.com/hashicorp/go-azure-sdk/resource-manager/azurefleet/2024-11-01/fleets
github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01
github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/arcsettings
github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2024-01-01/cluster
diff --git a/website/allowed-subcategories b/website/allowed-subcategories
index e0c83f7f73c6..f72d46b02f8c 100644
--- a/website/allowed-subcategories
+++ b/website/allowed-subcategories
@@ -26,6 +26,7 @@ Chaos Studio
Cognitive Services
Communication
Compute
+Compute Fleet
Confidential Ledger
Connections
Consumption
diff --git a/website/docs/r/compute_fleet.html.markdown b/website/docs/r/compute_fleet.html.markdown
new file mode 100644
index 000000000000..86341cee1af8
--- /dev/null
+++ b/website/docs/r/compute_fleet.html.markdown
@@ -0,0 +1,814 @@
+---
+subcategory: "Compute Fleet"
+layout: "azurerm"
+page_title: "Azure Resource Manager: azurerm_compute_fleet"
+description: |-
+ Manages a Compute Fleet in Flexible Orchestration Mode.
+---
+
+# azurerm_compute_fleet
+
+Manages a Compute Fleet in Flexible Orchestration Mode.
+
+## Example Usage
+
+```hcl
+resource "azurerm_resource_group" "example" {
+ name = "example-resources"
+ location = "East US"
+}
+
+resource "azurerm_virtual_network" "example" {
+ name = "example-vnet"
+ address_space = ["10.0.0.0/16"]
+ location = azurerm_resource_group.example.location
+ resource_group_name = azurerm_resource_group.example.name
+}
+
+resource "azurerm_subnet" "example" {
+ name = "example-subnet"
+ resource_group_name = azurerm_resource_group.example.name
+ virtual_network_name = azurerm_virtual_network.example.name
+ address_prefixes = ["10.0.2.0/24"]
+}
+
+resource "azurerm_public_ip" "example" {
+ name = "examplepip"
+ location = azurerm_resource_group.example.location
+ resource_group_name = azurerm_resource_group.example.name
+ allocation_method = "Static"
+ sku = "Standard"
+ zones = ["1"]
+}
+
+resource "azurerm_lb" "example" {
+ name = "example-lb"
+ location = azurerm_resource_group.example.location
+ resource_group_name = azurerm_resource_group.example.name
+ sku = "Standard"
+
+ frontend_ip_configuration {
+ name = "internal"
+ public_ip_address_id = azurerm_public_ip.example.id
+ }
+}
+
+resource "azurerm_lb_backend_address_pool" "example" {
+ name = "internal"
+ loadbalancer_id = azurerm_lb.example.id
+}
+
+resource "azurerm_compute_fleet" "example" {
+ name = "example-fleet"
+ resource_group_name = azurerm_resource_group.example.name
+ location = azurerm_resource_group.example.location
+
+ spot_priority_profile {
+ min_capacity = 0
+ maintain_enabled = false
+ capacity = 1
+ }
+
+ vm_sizes_profile {
+ name = "Standard_D1_v2"
+ }
+
+ compute_api_version = "2024-03-01"
+
+ virtual_machine_profile {
+ network_api_version = "2020-11-01"
+ source_image_reference {
+ publisher = "Canonical"
+ offer = "0001-com-ubuntu-server-jammy"
+ sku = "22_04-lts"
+ version = "latest"
+ }
+ os_disk {
+ caching = "ReadWrite"
+ storage_account_type = "Standard_LRS"
+ }
+ os_profile {
+ linux_configuration {
+ computer_name_prefix = "prefix"
+ admin_username = "testadmin1234"
+ password_authentication_enabled = false
+ admin_ssh_keys = [file("~/.ssh/id_rsa.pub")]
+ }
+ }
+
+ network_interface {
+ name = "networkProTest"
+ ip_configuration {
+ name = "ipConfig"
+ load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.example.id]
+ primary = true
+ subnet_id = azurerm_subnet.example.id
+ }
+ primary = true
+ }
+ }
+}
+```
+
+## Arguments Reference
+
+The following arguments are supported:
+* `name` - (Required) The name of the Compute Fleet. Changing this forces a new resource to be created.
+
+* `location` - (Required) The azure region where the Compute Fleet should exist. Changing this forces a new resource to be created.
+
+* `resource_group_name` - (Required) The name of the resource group in which the Compute Fleet should exist. Changing this forces a new resource to be created.
+
+* `virtual_machine_profile` - (Required) A `virtual_machine_profile` block as defined below. Changing this forces a new resource to be created.
+
+* `additional_capabilities_hibernation_enabled` - (Optional) Should the hibernation capability to be enabled on the Compute Fleet? Defaults to `false`. Changing this forces a new resource to be created.
+
+* `additional_capabilities_ultra_ssd_enabled` - (Optional) Should the capacity to enable Data Disks of the `UltraSSD_LRS` storage account type be supported on this Compute Fleet? Defaults to `false`. Changing this forces a new resource to be created.
+
+* `additional_location_profile` - (Optional) One or more `additional_location_profile` blocks as defined below. Changing this forces a new resource to be created.
+
+* `plan` - (Optional) A `plan` block as defined below. Changing this forces a new resource to be created.
+
+* `platform_fault_domain_count` - (Optional) Specifies the number of fault domains that are used by the Compute Fleet. Defaults to `1`. Changing this forces a new resource to be created.
+
+* `vm_attributes` - (Optional) A `vm_attributes` block as defined below. Changing this forces a new resource to be created.
+
+* `zones` - (Optional) Specifies a list of availability zones which the Compute Fleet is available. Changing this forces a new resource to be created.
+
+* `compute_api_version` - (Optional) Specifies the `Microsoft.Compute` API version to use when creating the Compute Fleet.
+
+* `identity` - (Optional) An `identity` block as defined below.
+
+* `regular_priority_profile` - (Optional) A `regular_priority_profile` block as defined below.
+
+* `spot_priority_profile` - (Optional) A `spot_priority_profile` block as defined below.
+
+* `tags` - (Optional) A mapping of tags which should be assigned to the Compute Fleet.
+
+* `vm_sizes_profile` - (Optional) One or more `vm_sizes_profile` blocks as defined below. Conflicts with `vm_attributes.0.excluded_vm_sizes`.
+
+-> **Note:** If `spot_priority_profile` is specified, `regular_priority_profile` is not specified and `spot_priority_profile.0.maintain_enabled` is specified as to `false`, changing `vm_sizes_profile` forces a new resource to be created.
+
+---
+
+A `virtual_machine_profile` block supports the following:
+
+* `os_profile` - (Required) A `os_profile` block as defined above.
+
+* `network_api_version` - (Required) Specifies the Microsoft.Network API version used when creating networking resources in the network interface configurations for the Compute Fleet.
+
+* `network_interface` - (Required) One or more `network_interface` blocks as defined above.
+
+* `boot_diagnostic_enabled` - (Optional) Should the boot diagnostics be enabled on the virtual machine? Defaults to `false`.
+
+* `boot_diagnostic_storage_account_endpoint` - (Optional) Specifies endpoint of the storage account to use for placing the console output and screenshot.
+
+* `capacity_reservation_group_id` - (Optional) Specifies the ID of the capacity reservation group which the Compute Fleet should be allocated to.
+
+* `data_disk` - (Optional) One or more `data_disk` blocks as defined above.
+
+* `encryption_at_host_enabled` - (Optional) Should disks attached to the Compute Fleet be encrypted by enabling encryption at host? Defaults to `false`.
+
+* `extension` - (Optional) One or more `extension` blocks as defined above.
+
+* `extension_operations_enabled` - (Optional) Should extension operations be allowed on the Compute Fleet? Defaults to `true`.
+
+* `extensions_time_budget` - (Optional) Specifies the time alloted for all extensions to start.
+
+* `gallery_application` - (Optional) One or more `gallery_application` blocks as defined above.
+
+* `license_type` - (Optional) Specifies the type of on-premise license (also known as Azure Hybrid Use Benefit) which should be used for the Compute Fleet. Possible values are `RHEL_BYOS`, `SLES_BYOS`, `Windows_Client` and `Windows_Server`.
+
+* `os_disk` - (Optional) A `os_disk` block as defined above.
+
+* `scheduled_event_os_image_timeout` - (Optional) Specifies the length of time a virtual machine being deleted will have to potentially approve the terminate scheduled event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format. Only possible value is `PT15M`.
+
+* `scheduled_event_termination_timeout` - (Optional) Specifies the length of time a virtual machine being re-imaged or having its OS upgraded will have to potentially approve the OS image scheduled event before the event is auto approved (timed out). The configuration is specified in ISO 8601 format. Possible values are `PT5M` and `PT15M`.
+
+* `secure_boot_enabled` - (Optional) Should the secure boot be enabled the virtual machine? Defaults to `false`.
+
+* `source_image_id` - (Optional) The ID of an image which each virtual machine in the Compute Fleet should be based on. Possible Image ID types include `Image ID`s, `Shared Image ID`s, `Shared Image Version ID`s, `Community Gallery Image ID`s, `Community Gallery Image Version ID`s, `Shared Gallery Image ID`s and `Shared Gallery Image Version ID`s.
+
+* `source_image_reference` - (Optional) A `source_image_reference` block as defined above.
+
+* `user_data_base64` - (Optional) The base64-encoded User Data which should be used for the Compute Fleet.
+
+* `vtpm_enabled` - (Optional) Should the vTPM be enabled on the virtual machine? Defaults to `false`.
+
+---
+
+A `network_interface` block supports the following:
+
+* `name` - (Required) The name which should be used for the network interface.
+
+* `ip_configuration` - (Required) One or more `ip_configuration` blocks as defined above.
+
+* `accelerated_networking_enabled` - (Optional) Should the network interface support accelerated networking be enabled? Defaults to `false`.
+
+* `auxiliary_mode` - (Optional) Specifies the auxiliary mode for the network interface. Possible values are `AcceleratedConnections` and `Floating`.
+
+* `auxiliary_sku` - (Optional) Specifies the auxiliary sku for the network interface. Possible values are `A8`, `A4`, `A1` and `A2`.
+
+* `delete_option` - (Optional) Specify what happens to the network interface when the virtual machine is deleted. Possible values are `Delete` and `Detach`.
+
+* `dns_servers` - (Optional) Specifies a list of IP addresses of DNS servers which should be assigned to the network interface.
+
+* `ip_forwarding_enabled` - (Optional) Should the network interface support IP forwarding be enabled? Defaults to `false`.
+
+* `network_security_group_id` - (Optional) The ID of the network security group which should be assigned to the network interface.
+
+* `primary` - (Optional) Is this the primary network interface? Defaults to `false`.
+
+---
+
+A `os_profile` block supports the following:
+
+* `custom_data_base64` - (Optional) The base64-encoded custom data which should be used for the Compute Fleet.
+
+* `linux_configuration` - (Optional) A `linux_configuration` block as defined above. Changing this forces a new resource to be created.
+
+* `windows_configuration` - (Optional) A `windows_configuration` block as defined below. Changing this forces a new resource to be created.
+
+---
+
+A `accelerator_count` block supports the following:
+
+* `max` - (Optional) The maximum value of accelerator count.
+
+* `min` - (Optional) The minimum value of accelerator count.
+
+---
+
+A `additional_location_profile` block supports the following:
+
+* `location` - (Required) The Azure Region where the Compute Fleet should exist. Changing this forces a new resource to be created.
+
+* `virtual_machine_profile_override` - (Required) The definition of the `virtual_machine_profile_override` block is the same as the `virtual_machine_profile` block. A `virtual_machine_profile` block as defined below. Changing this forces a new resource to be created.
+
+---
+
+A `additional_unattend_content` block supports the following:
+
+* `content` - (Required) Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component.
+
+* `setting` - (Required) Specifies the name of the setting to which the content applies. Possible values are `AutoLogon` and `FirstLogonCommands`.
+
+---
+
+A (Windows) `certificate` block supports the following:
+
+* `url` - (Required) The secret URL of a key vault certificate.
+
+* `store` - (Optional) The certificate store on the virtual machine where the certificate should be added.
+
+---
+
+
+A (Linux) `certificate` block supports the following:
+
+* `url` - (Required) The secret URL of a key vault certificate.
+
+---
+
+A `data_disk` block supports the following:
+
+* `create_option` - (Required) The create option which should be used for the data disk. Possible values are `Empty` and `FromImage`.
+
+-> **Note:** `FromImage` should only be used if the source image includes data disks.
+
+* `caching` - (Optional) The type of caching which should be used for the data disk. Possible values are `ReadOnly` and `ReadWrite`.
+
+* `delete_option` - (Optional) Specify what happens to the data disk when the virtual machine is deleted. Possible values are `Delete` and `Detach`.
+
+* `disk_encryption_set_id` - (Optional) The ID of the disk encryption set which should be used to encrypt the data disk.
+
+* `disk_size_in_gb` - (Optional) The size of the data disk which should be created. Required if `create_option` is specified as `Empty`.
+
+* `lun` - (Optional) The logical unit number of the data disk, which must be unique within the virtual machine. Required if `create_option` is specified as `Empty`.
+
+* `storage_account_type` - (Optional) The type of storage account which should back the data disk. Possible values include `Premium_LRS`, `PremiumV2_LRS`, `Premium_ZRS`, `Standard_LRS`, `StandardSSD_LRS`, `StandardSSD_ZRS` and `UltraSSD_LRS`.
+
+* `write_accelerator_enabled` - (Optional) Should the write accelerator be enabled on the data disk? Defaults to `false`.
+
+---
+
+A `data_disk_count` block supports the following:
+
+* `max` - (Optional) The maximum value of data disk count.
+
+* `min` - (Optional) The minimum value of data disk count.
+
+---
+
+A `extension` block supports the following:
+
+* `name` - (Required) The name for the Compute Fleet extension.
+
+* `publisher` - (Required) Specifies the Publisher of the extension.
+
+* `type` - (Required) Specifies the Type of the extension.
+
+* `type_handler_version` - (Required) Specifies the version of the extension to use, available versions can be found using the Azure CLI.
+
+* `auto_upgrade_minor_version_enabled` - (Optional) Should the latest version of the extension be used at deployment time, if one is available? This won't auto-update the extension on existing installation. Defaults to `false`.
+
+* `automatic_upgrade_enabled` - (Optional) Should the extension be automatically upgraded by the platform, if there is a newer version of the extension available? Defaults to `false`.
+
+* `extensions_to_provision_after_vm_creation` - (Optional) Specifies an ordered list of extension names which Compute Fleet should provision after virtual machine creation.
+
+* `failure_suppression_enabled` - (Optional) Should the failures from the extension be suppressed? Defaults to `false`.
+
+-> **Note:** Operational failures such as not connecting to the virtual machine will not be suppressed regardless of the `failure_suppression_enabled` value.
+
+* `force_extension_execution_on_change` - (Optional) A value which, when different to the previous value can be used to force-run the extension even if the extension configuration hasn't changed.
+
+* `protected_settings_from_key_vault` - (Optional) A `protected_settings_from_key_vault` block as defined below.
+
+* `protected_settings_json` - (Optional) A JSON string which specifies sensitive settings (such as passwords) for the extension.
+
+-> **Note:** Keys within the `protected_settings_json` block are notoriously case-sensitive, where the casing required (e.g. `TitleCase` vs `snakeCase`) depends on the extension being used. Please refer to the documentation for the specific virtual machine extension you're looking to use for more information.
+
+* `settings_json` - (Optional) A JSON string which specifies settings for the extension.
+
+---
+
+A `gallery_application` block supports the following:
+
+* `version_id` - (Required) Specifies the gallery application version resource ID.
+
+* `automatic_upgrade_enabled` - (Optional) Should the gallery application be automatically upgraded, if there is a newer version of the gallery application available? Defaults to `false`.
+
+* `configuration_blob_uri` - (Optional) Specifies the URI to an azure blob that will replace the default configuration for the package if provided.
+
+* `order` - (Optional) Specifies the order in which the packages have to be installed. Defaults to `0`.
+
+* `tag` - (Optional) Specifies a passthrough value for more generic context.
+
+* `treat_failure_as_deployment_failure_enabled` - (Optional) Should any failure for any operation in the virtual machine application will fail the deployment be enabled? Defaults to `false`.
+
+---
+
+A `identity` block supports the following:
+
+* `type` - (Required) The type of managed identity that should be configured on the Compute Fleet. Only possible value is `UserAssigned`.
+
+* `identity_ids` - (Optional) Specifies a list of user managed identity IDs to be assigned to the Compute Fleet.
+
+---
+
+A `ip_configuration` block supports the following:
+
+* `name` - (Required) The Name which should be used for the IP configuration.
+
+* `subnet_id` - (Required) The ID of the Subnet which the IP configuration should be connected to.
+
+* `application_gateway_backend_address_pool_ids` - (Optional) Specifies a list of backend address pools IDs from an application gateway which the Compute Fleet should be connected to.
+
+* `application_security_group_ids` - (Optional) Specifies a list of application security group IDs which the Compute Fleet should be connected to.
+
+* `load_balancer_backend_address_pool_ids` - (Optional) Specifies a list of backend address pools IDs from a load balancer which the Compute Fleet should be connected to.
+
+* `primary` - (Optional) Is this the primary IP configuration? Defaults to `false`.
+
+* `public_ip_address` - (Optional) One or more `public_ip_address` blocks as defined below.
+
+* `version` - (Optional) The internet protocol version which should be used for the IP configuration. Possible values are `IPv4` and `IPv6`. Defaults to `IPv4`.
+
+---
+
+A `ip_tag` block supports the following:
+
+* `tag` - (Required) The IP tag associated with the public IP.
+
+* `type` - (Required) The type of IP tag.
+
+---
+
+A `linux_configuration` block supports the following:
+
+* `admin_username` - (Required) Specifies the name of the administrator account.
+
+* `computer_name_prefix` - (Required) Specifies the computer name prefix for all the linux virtual machines in the Compute Fleet.
+
+* `admin_password` - (Optional) Specifies the password of the administrator account.
+
+* `admin_ssh_keys` - (Optional) Specifies a list of the public key which should be used for authentication, which needs to be in `ssh-rsa` format with at least 2048-bit or in `ssh-ed25519` format.
+
+* `bypass_platform_safety_checks_enabled` - (Optional) Should the customer to schedule patching without accidental upgrades be enabled? Defaults to `false`.
+
+* `password_authentication_enabled` - (Optional) When an `admin_password` is specified `password_authentication_enabled` must be set to `true`. Defaults to `false`.
+
+* `patch_assessment_mode` - (Optional) Specifies the mode of virtual machine Guest Patching for the virtual machines that are associated to the Compute Fleet. Only possible value is `ImageDefault`.
+
+* `patch_mode` - (Optional) Specifies the mode of in-guest patching of the virtual machines. Possible values are `AutomaticByPlatform` and `ImageDefault`.
+
+* `provision_vm_agent_enabled` - (Optional) Should the virtual machine agent be provisioned on each virtual machine in the Scale Set? Defaults to `true`.
+
+* `reboot_setting` - (Optional) Specifies the reboot setting for all `AutomaticByPlatform` patch installation operations. Possible values are `Always`, `IfRequired`, `Never` and `Unknown`.
+
+* `secret` - (Optional) One or more `secret` blocks as defined below.
+
+* `vm_agent_platform_updates_enabled` - (Optional) Should the virtual machine agent be provisioned on each linux virtual machine in the Compute Fleet? Defaults to `false`.
+
+---
+
+A `local_storage_in_gib` block supports the following:
+
+* `max` - (Optional) The maximum value of local storage in GiB.
+
+* `min` - (Optional) The minimum value of local storage in GiB.
+
+---
+
+A `memory_in_gib` block supports the following:
+
+* `max` - (Optional) The maximum value of memory in GiB.
+
+* `min` - (Optional) The minimum value of memory in GiB.
+
+---
+
+A `memory_in_gib_per_vcpu` block supports the following:
+
+* `max` - (Optional) The maximum value of memory per vCPU in GiB.
+
+* `min` - (Optional) The minimum value of memory per vCPU in GiB.
+
+---
+
+A `network_bandwidth_in_mbps` block supports the following:
+
+* `max` - (Optional) The maximum value of network bandwidth in Mbps.
+
+* `min` - (Optional) The minimum value of network bandwidth in Mbps.
+
+---
+
+A `network_interface` block supports the following:
+
+* `name` - (Required) The name which should be used for the network interface.
+
+* `ip_configuration` - (Required) One or more `ip_configuration` blocks as defined above.
+
+* `accelerated_networking_enabled` - (Optional) Should the network interface support accelerated networking be enabled? Defaults to `false`.
+
+* `auxiliary_mode` - (Optional) Specifies the auxiliary mode for the network interface. Possible values are `AcceleratedConnections` and `Floating`.
+
+* `auxiliary_sku` - (Optional) Specifies the auxiliary sku for the network interface. Possible values are `A8`, `A4`, `A1` and `A2`.
+
+* `delete_option` - (Optional) Specify what happens to the network interface when the virtual machine is deleted. Possible values are `Delete` and `Detach`.
+
+* `dns_servers` - (Optional) Specifies a list of IP addresses of DNS servers which should be assigned to the network interface.
+
+* `ip_forwarding_enabled` - (Optional) Should the network interface support IP forwarding be enabled? Defaults to `false`.
+
+* `network_security_group_id` - (Optional) The ID of the network security group which should be assigned to the network interface.
+
+* `primary` - (Optional) Is this the primary network interface? Defaults to `false`.
+
+---
+
+A `network_interface_count` block supports the following:
+
+* `max` - (Optional) The maximum value of network interface count.
+
+* `min` - (Optional) The minimum value of network interface count.
+
+*
+
+---
+
+A `os_disk` block supports the following:
+
+* `caching` - (Optional) The Type of caching which should be used for the internal OS Disk. Possible values are `ReadOnly` and `ReadWrite`.
+
+* `delete_option` - (Optional) Specify what happens to the os disk when the virtual machine is deleted. Possible values are `Delete` and `Detach`.
+
+* `diff_disk_option` - (Optional) Specifies the Ephemeral Disk Settings for the OS Disk. Only possible value is `Local`.
+
+* `diff_disk_placement` - (Optional) Specifies where to store the Ephemeral Disk. Possible values are `CacheDisk`, `NvmeDisk` and `ResourceDisk`.
+
+* `disk_encryption_set_id` - (Optional) The ID of the Disk Encryption Set which should be used to encrypt the OS Disk.
+
+* `disk_size_in_gb` - (Optional) The size of the internal OS Disk in GB, if you wish to vary from the size used in the image the Compute Fleet is sourced from.
+
+* `security_encryption_type` - (Optional) Specifies the encryption type of the OS Disk. Possible values are `DiskWithVMGuestState`, `NonPersistedTPM` and `VMGuestStateOnly`.
+
+* `storage_account_type` - (Optional) The Type of Storage Account which should back the OS Disk. Possible values include `Premium_LRS`, `Premium_ZRS`, `Standard_LRS`, `StandardSSD_LRS` and `StandardSSD_ZRS`.
+
+* `write_accelerator_enabled` - (Optional) Should the write accelerator be enabled on the OS Disk? Defaults to `false`.
+
+---
+
+A `os_profile` block supports the following:
+
+* `custom_data_base64` - (Optional) The base64-encoded Custom Data which should be used for the Compute Fleet.
+
+* `linux_configuration` - (Optional) A `linux_configuration` block as defined above. Changing this forces a new resource to be created.
+
+* `windows_configuration` - (Optional) A `windows_configuration` block as defined below. Changing this forces a new resource to be created.
+
+---
+
+A `plan` block supports the following:
+
+* `name` - (Required) Specifies the name of the image from the marketplace. Changing this forces a new resource to be created.
+
+* `product` - (Required) Specifies the product of the image from the marketplace. Changing this forces a new resource to be created.
+
+* `publisher` - (Required) Specifies the publisher of the image. Changing this forces a new resource to be created.
+
+* `promotion_code` - (Optional) Specifies the promotion code of the image from the marketplace.
+
+---
+
+A `protected_settings_from_key_vault` block supports the following:
+
+* `secret_url` - (Required) The URL to the key vault secret which stores the protected settings.
+
+* `source_vault_id` - (Required) The ID of the source key vault.
+
+---
+
+A `public_ip_address` block supports the following:
+
+* `name` - (Required) The name of the Public IP Address Configuration.
+
+* `delete_option` - (Optional) Specify what happens to the public ip address when the virtual machine is deleted. Possible values are `Delete` and `Detach`.
+
+* `domain_name_label` - (Optional) The prefix which should be used for the domain name label for each virtual machine. Azure concatenates the domain name label and virtual machine index to create a unique domain name label for each virtual machine.
+
+* `domain_name_label_scope` - (Optional) The domain name label scope. Possible values are `NoReuse`, `ResourceGroupReuse`, `SubscriptionReuse` and `TenantReuse`.
+
+* `idle_timeout_in_minutes` - (Optional) The idle timeout in minutes for the public IP address. Possible values are in the range `4` to `32`.
+
+* `ip_tag` - (Optional) One or more `ip_tag` blocks as defined above.
+
+* `public_ip_prefix_id` - (Optional) The ID of the public IP address prefix from where public IP addresses should be allocated.
+
+* `sku_name` - (Optional) Specifies what public IP address SKU the public IP address should be provisioned as. Possible values are `Standard_Regional` and `Standard_Global`.
+
+* `version` - (Optional) The internet protocol version which should be used for the public IP address. Possible values are `IPv4` and `IPv6`. Defaults to `IPv4`.
+
+---
+
+A `rdma_network_interface_count` block supports the following:
+
+* `max` - (Optional) The maximum value of RDMA (Remote Direct Memory Access) network interface count.
+
+* `min` - (Optional) The minimum value of RDMA (Remote Direct Memory Access) network interface count.
+
+---
+
+A `regular_priority_profile` block supports the following:
+
+* `allocation_strategy` - (Optional) Specifies the allocation strategy for the Compute Fleet on which the standard virtual machines will be allocated. Defaults to `LowestPrice`. Possible values are `LowestPrice` and `Prioritized`. Changing this forces a new resource to be created.
+
+* `capacity` - (Optional) The total number of the standard virtual machines in the Compute Fleet.
+
+* `min_capacity` - (Optional) The minimum number of standard virtual machines in the Compute Fleet. Changing this forces a new resource to be created.
+
+---
+
+A `secret` block supports the following:
+
+* `certificate` - (Required) One or more `certificate` blocks as defined above.
+
+* `key_vault_id` - (Required) The ID of the key vault from which all secrets should be sourced.
+
+---
+
+A `source_image_reference` block supports the following:
+
+* `offer` - (Required) Specifies the offer of the image used to create the virtual machines. Changing this forces a new resource to be created.
+
+* `publisher` - (Required) Specifies the publisher of the image used to create the virtual machines. Changing this forces a new resource to be created.
+
+* `sku` - (Required) Specifies the SKU of the image used to create the virtual machines.
+
+* `version` - (Required) Specifies the version of the image used to create the virtual machines.
+
+---
+
+A `spot_priority_profile` block supports the following:
+
+* `allocation_strategy` - (Optional) Specifies the allocation strategy for the Compute Fleet on which the Azure spot virtual machines will be allocated. Defaults to `PriceCapacityOptimized`. Possible values are `LowestPrice`, `PriceCapacityOptimized`, `CapacityOptimized`. Changing this forces a new resource to be created.
+
+* `eviction_policy` - (Optional) The policy which should be used by spot virtual machines that are evicted from the Compute Fleet. Defaults to `Delete`. Possible values are `Deallocate` and `Delete`. Changing this forces a new resource to be created.
+
+* `maintain_enabled` - (Optional) Should the continuous goal seeking for the desired capacity and restoration of evicted spot virtual machines be enabled? Defaults to `true`. Changing this forces a new resource to be created.
+
+* `max_hourly_price_per_vm` - (Optional) The maximum price per hour of each spot virtual machine. Defaults to `-1`. Changing this forces a new resource to be created.
+
+* `min_capacity` - (Optional) The minimum number of spot virtual machines in the Compute Fleet. Changing this forces a new resource to be created.
+
+* `capacity` - (Optional) The total number of the spot virtual machines in the Compute Fleet.
+
+---
+
+A `vcpu_count` block supports the following:
+
+* `max` - (Optional) The maximum value of vCPU count.
+
+* `min` - (Optional) The minimum value of vCPU count.
+
+---
+
+A `virtual_machine_profile` block supports the following:
+
+* `os_profile` - (Required) A `os_profile` block as defined above.
+
+* `network_api_version` - (Required) Specifies the Microsoft.Network API version used when creating networking resources in the network interface configurations for the Compute Fleet.
+
+* `network_interface` - (Required) One or more `network_interface` blocks as defined above.
+
+* `boot_diagnostic_enabled` - (Optional) Should the boot diagnostics be enabled on the virtual machine? Defaults to `false`.
+
+* `boot_diagnostic_storage_account_endpoint` - (Optional) Specifies endpoint of the storage account to use for placing the console output and screenshot.
+
+* `capacity_reservation_group_id` - (Optional) Specifies the ID of the capacity reservation group which the Compute Fleet should be allocated to.
+
+* `data_disk` - (Optional) One or more `data_disk` blocks as defined above.
+
+* `encryption_at_host_enabled` - (Optional) Should disks attached to the Compute Fleet be encrypted by enabling encryption at host? Defaults to `false`.
+
+* `extension` - (Optional) One or more `extension` blocks as defined above.
+
+* `extension_operations_enabled` - (Optional) Should extension operations be allowed on the Compute Fleet? Defaults to `true`.
+
+* `extensions_time_budget` - (Optional) Specifies the time alloted for all extensions to start.
+
+* `gallery_application` - (Optional) One or more `gallery_application` blocks as defined above.
+
+* `license_type` - (Optional) Specifies the type of on-premise license (also known as Azure Hybrid Use Benefit) which should be used for the Compute Fleet. Possible values are `RHEL_BYOS`, `SLES_BYOS`, `Windows_Client` and `Windows_Server`.
+
+* `os_disk` - (Optional) A `os_disk` block as defined above.
+
+* `scheduled_event_os_image_timeout` - (Optional) Specifies the length of time a virtual machine being deleted will have to potentially approve the terminate scheduled event before the event is auto approved (timed out). The configuration must be specified in ISO 8601 format. Only possible value is `PT15M`.
+
+* `scheduled_event_termination_timeout` - (Optional) Specifies the length of time a virtual machine being reimaged or having its OS upgraded will have to potentially approve the OS image scheduled event before the event is auto approved (timed out). The configuration is specified in ISO 8601 format. Possible values are `PT5M` and `PT15M`.
+
+* `secure_boot_enabled` - (Optional) Should the secure boot be enabled the virtual machine? Defaults to `false`.
+
+* `source_image_id` - (Optional) The ID of an image which each virtual machine in the Compute Fleet should be based on. Possible Image ID types include `Image ID`s, `Shared Image ID`s, `Shared Image Version ID`s, `Community Gallery Image ID`s, `Community Gallery Image Version ID`s, `Shared Gallery Image ID`s and `Shared Gallery Image Version ID`s.
+
+* `source_image_reference` - (Optional) A `source_image_reference` block as defined above.
+
+* `user_data_base64` - (Optional) The base64-encoded User Data which should be used for the Compute Fleet.
+
+* `vtpm_enabled` - (Optional) Should the vTPM be enabled on the virtual machine? Defaults to `false`.
+
+---
+
+A `vm_attributes` block supports the following:
+
+* `memory_in_gib` - (Required) A `memory_in_gib` block as defined above.
+
+* `vcpu_count` - (Required) A `vcpu_count` block as defined above.
+
+* `accelerator_count` - (Optional) A `accelerator_count` block as defined above.
+
+-> **Note:** Once the `accelerator_count` has been specified, removing it forces a new resource to be created.
+
+* `accelerator_manufacturers` - (Optional) Specifies a list of the accelerator manufacturers. Possible values are `AMD`, `Nvidia` and `Xilinx`.
+
+-> **Note:** Once the `accelerator_manufacturers` has been specified, removing it forces a new resource to be created.
+
+* `accelerator_support` - (Optional) Specifies whether the virtual machine sizes supporting accelerator be used to build the Compute Fleet. Defaults to `Excluded`. Possible values are `Excluded`, `Included` and `Required`.
+
+-> **Note:** Once the `accelerator_support` has been specified, removing it forces a new resource to be created.
+
+* `accelerator_types` - (Optional) Specifies a list of the accelerator types. Possible values are `FPGA` and `GPU`.
+
+-> **Note:** Once the `accelerator_types` has been specified, removing it forces a new resource to be created.
+
+* `architecture_types` - (Optional) Specifies a list of the architecture types. Possible values are `ARM64` and `X64`.
+
+-> **Note:** Once the `architecture_types` has been specified, removing it forces a new resource to be created.
+
+* `burstable_support` - (Optional) Specifies whether the virtual machine Sizes supporting burstable capability be used to build the Compute Fleet. Defaults to `Excluded`. Possible values are `Excluded`, `Included` and `Required`.
+
+-> **Note:** Once the `burstable_support` has been specified, removing it forces a new resource to be created.
+
+* `cpu_manufacturers` - (Optional) Specifies a list of the virtual machine CPU manufacturers. Possible values are `AMD`, `Ampere`, `Intel` and `Microsoft`.
+
+-> **Note:** Once the `cpu_manufacturers` has been specified, removing it forces a new resource to be created.
+
+* `data_disk_count` - (Optional) A `data_disk_count` block as defined above.
+
+-> **Note:** Once the `data_disk_count` has been specified, removing it forces a new resource to be created.
+
+* `excluded_vm_sizes` - (Optional) Specifies a list of excluded virtual machine sizes. Conflicts with `vm_sizes_profile`.
+
+-> **Note:** Once the `excluded_vm_sizes` has been specified, removing it forces a new resource to be created.
+
+* `local_storage_disk_types` - (Optional) Specifies a list of the local storage disk types supported by virtual machines. Possible values are `HDD` and `SSD`.
+
+-> **Note:** Once the `local_storage_disk_types` has been specified, removing it forces a new resource to be created.
+
+* `local_storage_in_gib` - (Optional) A `local_storage_in_gib` block as defined above.
+
+-> **Note:** Once the `local_storage_in_gib` has been specified, removing it forces a new resource to be created.
+
+* `local_storage_support` - (Optional) Specifies whether the virtual machine Sizes supporting local storage be used to build the Compute Fleet. Defaults to `Included`. Possible values are `Excluded`, `Included` and `Required`.
+
+-> **Note:** Once the `local_storage_support` has been specified, removing it forces a new resource to be created.
+
+* `memory_in_gib_per_vcpu` - (Optional) A `memory_in_gib_per_vcpu` block as defined above.
+
+-> **Note:** Once the `memory_in_gib_per_vcpu` has been specified, removing it forces a new resource to be created.
+
+* `network_bandwidth_in_mbps` - (Optional) A `network_bandwidth_in_mbps` block as defined above.
+
+-> **Note:** Once the `network_bandwidth_in_mbps` has been specified, removing it forces a new resource to be created.
+
+* `network_interface_count` - (Optional) A `network_interface_count` block as defined above.
+
+-> **Note:** Once the `network_interface_count` has been specified, removing it forces a new resource to be created.
+
+* `rdma_network_interface_count` - (Optional) A `rdma_network_interface_count` block as defined above.
+
+-> **Note:** Once the `rdma_network_interface_count` has been specified, removing it forces a new resource to be created.
+
+* `rdma_support` - (Optional) Specifies whether the virtual machine Sizes supporting RDMA (Remote Direct Memory Access) be used to build the Compute Fleet. Defaults to `Excluded`. Possible values are `Excluded`, `Included` and `Required`.
+
+-> **Note:** Once the `rdma_support` has been specified, removing it forces a new resource to be created.
+
+* `vm_categories` - (Optional) Specifies a list of the virtual machine categories. Possible values are `ComputeOptimized`, `FpgaAccelerated`, `GeneralPurpose`, `GpuAccelerated`, `HighPerformanceCompute`, `MemoryOptimized` and `StorageOptimized`.
+
+-> **Note:** Once the `vm_categories` has been specified, removing it forces a new resource to be created.
+
+---
+
+A `vm_sizes_profile` block supports the following:
+
+* `name` - (Required) The name of the virtual machine size.
+
+* `rank` - (Optional) The rank of the virtual machine size.
+
+---
+
+A `windows_configuration` block supports the following:
+
+* `admin_username` - (Required) Specifies the name of the administrator account.
+
+* `admin_password` - (Required) Specifies the password of the administrator account.
+
+* `computer_name_prefix` - (Required) Specifies the computer name prefix for all the windows virtual machines in the Compute Fleet.
+
+* `additional_unattend_content` - (Optional) One or more `additional_unattend_content` blocks as defined above.
+
+* `automatic_updates_enabled` - (Optional) Should the automatic updates of the virtual machines be enabled? Defaults to `true`.
+
+* `bypass_platform_safety_checks_enabled` - (Optional) Should the customer to schedule patching without accidental upgrades be enabled? Defaults to `false`.
+
+* `hot_patching_enabled` - (Optional) Should the customers to patch the virtual machines without requiring a reboot be enabled? Defaults to `false`.
+
+* `patch_assessment_mode` - (Optional) Specifies the mode of virtual machine Guest Patching for the virtual machines that are associated to the Compute Fleet. Only possible value is `ImageDefault`.
+
+* `patch_mode` - (Optional) Specifies the mode of in-guest patching of the virtual machines. Possible values are `AutomaticByOS`, `AutomaticByPlatform` and `Manual`.
+
+* `provision_vm_agent_enabled` - (Optional) Should the virtual machine agent be provisioned on each virtual machine in the Scale Set? Defaults to `true`.
+
+* `reboot_setting` - (Optional) Specifies the reboot setting for all `AutomaticByPlatform` patch installation operations. Possible values are `Always`, `IfRequired`, `Never` and `Unknown`.
+
+* `secret` - (Optional) One or more `secret` blocks as defined above.
+
+* `time_zone` - (Optional) Specifies the time zone of the windows virtual machine. Changing this forces a new resource to be created.
+
+* `vm_agent_platform_updates_enabled` - (Optional) Should the virtual machine agent platform updates be enabled for the windows virtual machine? Defaults to `false`.
+
+* `winrm_listener` - (Optional) One or more `winrm_listener` blocks as defined below. Changing this forces a new resource to be created.
+
+---
+
+A `winrm_listener` block supports the following:
+
+* `protocol` - (Required) Specifies the protocol of listener. Possible values are `Http` or `Https`. Changing this forces a new resource to be created.
+
+* `certificate_url` - (Optional) The secret URL of a key vault certificate, which must be specified when protocol is set to `Https`. Changing this forces a new resource to be created.
+
+## Attributes Reference
+
+In addition to the Arguments listed above - the following Attributes are exported:
+
+* `id` - The ID of the Compute Fleet.
+
+* `unique_id` - The Unique ID for the Compute Fleet.
+
+## Timeouts
+
+The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
+
+* `create` - (Defaults to 30 minutes) Used when creating the Compute Fleet.
+* `read` - (Defaults to 5 minutes) Used when retrieving the Compute Fleet.
+* `update` - (Defaults to 30 minutes) Used when updating the Compute Fleet.
+* `delete` - (Defaults to 30 minutes) Used when deleting the Compute Fleet.
+
+## Import
+
+Compute Fleets can be imported using the `resource id`, e.g.
+
+```shell
+terraform import azurerm_compute_fleet.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AzureFleet/fleets/fleetName
+```