Azure Compute Dedicated Host
This page shows how to write Terraform and Azure Resource Manager for Compute Dedicated Host and write them securely.
azurerm_dedicated_host (Terraform)
The Dedicated Host in Compute can be configured in Terraform with the resource name azurerm_dedicated_host
. The following sections describe 7 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_dedicated_host" "dedicated_host" {
count = length(var.dedicated_hosts)
name = lookup(var.dedicated_hosts[count.index], "name")
location = element(var.location, lookup(var.dedicated_hosts[count.index], "location_id"))
dedicated_host_group_id = element(var.dedicated_host_group_id, lookup(var.dedicated_hosts[count.index], "dedicated_host_group_id"))
sku_name = lookup(var.dedicated_hosts[count.index], "sku_name")
resource "azurerm_dedicated_host" "dh" {
name = azurecaf_name.dh.result
dedicated_host_group_id = var.dedicated_host_group_id
location = var.location
sku_name = var.settings.sku_name
platform_fault_domain = var.settings.platform_fault_domain
resource "azurerm_dedicated_host" "example" {
name = var.name
location = module.resource_group.azurerm_resource_group.example.location
dedicated_host_group_id = module.dedicated_host_group.azurerm_dedicated_host_group.example.id
sku_name = var.sku
platform_fault_domain = var.platform_fault_domain
resource "azurerm_dedicated_host" "dh" {
name = azurecaf_name.dh.result
dedicated_host_group_id = var.dedicated_host_group_id
location = var.location
sku_name = var.settings.sku_name
platform_fault_domain = var.settings.platform_fault_domain
resource "azurerm_dedicated_host" "this" {
auto_replace_on_failure = var.auto_replace_on_failure
dedicated_host_group_id = var.dedicated_host_group_id
license_type = var.license_type
location = var.location
name = var.name
resource "azurerm_dedicated_host" "this" {
auto_replace_on_failure = var.auto_replace_on_failure
dedicated_host_group_id = var.dedicated_host_group_id
license_type = var.license_type
location = var.location
name = var.name
resource "azurerm_dedicated_host" "dh" {
name = azurecaf_name.dh.result
dedicated_host_group_id = var.dedicated_host_group_id
location = var.location
sku_name = var.settings.sku_name
platform_fault_domain = var.settings.platform_fault_domain
Parameters
-
auto_replace_on_failure
optional - bool -
dedicated_host_group_id
required - string -
id
optional computed - string -
license_type
optional - string -
location
required - string -
name
required - string -
platform_fault_domain
required - number -
sku_name
required - string -
tags
optional - map from string to string -
timeouts
single block
Explanation in Terraform Registry
Manage a Dedicated Host within a Dedicated Host Group.
Tips: Best Practices for The Other Azure Compute Resources
In addition to the azurerm_linux_virtual_machine, Azure Compute has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_linux_virtual_machine
Ensure to use SSH authentication for virtual machines
It is better to use SSH authentication for virtual machines instead of password authentication to enforce more secure ways.
azurerm_managed_disk
Ensure to enable the encryption on managed disks
It is better to enable the encryption on managed disks.
azurerm_virtual_machine
Ensure to use SSH authentication for virtual machines
It is better to use SSH authentication for virtual machines instead of password authentication to enforce more secure ways.
Microsoft.Compute/hostGroups/hosts (Azure Resource Manager)
The hostGroups/hosts in Microsoft.Compute can be configured in Azure Resource Manager with the resource name Microsoft.Compute/hostGroups/hosts
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
Parameters
apiVersion
required - stringlocation
required - stringResource location
name
required - stringThe name of the dedicated host .
properties
requiredautoReplaceOnFailure
optional - booleanSpecifies whether the dedicated host should be replaced automatically in case of a failure. The value is defaulted to 'true' when not provided.
licenseType
optional - stringSpecifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: None Windows_Server_Hybrid Windows_Server_Perpetual Default: None.
platformFaultDomain
optional - integerFault domain of the dedicated host within a dedicated host group.
sku
requiredcapacity
optional - integerSpecifies the number of virtual machines in the scale set.
name
optional - stringThe sku name.
tier
optional - stringSpecifies the tier of virtual machines in a scale set. Possible Values: Standard Basic
tags
optional - stringResource tags
type
required - string
Frequently asked questions
What is Azure Compute Dedicated Host?
Azure Compute Dedicated Host is a resource for Compute of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Compute Dedicated Host?
For Terraform, the mikamakusa/terraform, aztfmod/terraform-azurerm-caf and VentsislavDinev/en_sample source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the mgyannainglin/az, senareddt2019/Sample-Scripts and zzhang01/azure-quickstart-templates source code examples are useful. See the Azure Resource Manager Example section for further details.