_This issue was originally opened by @cpatte7372 as hashicorp/terraform#16363. It was migrated here as a result of the provider split. The original body of the issue is below._
Hello Community,
Can someone please let me know if there are any tools that will allow me to convert Azure JSON to Terraform TF?
Thanks
Carlton
Any thoughts on this question guys / girls?
Hi Guys,
I found the following link https://github.com/kvz/json2hcl which appears to be able carry out the conversion. However, I'm not sure how to execute the windows release.
Any help will be greatly appreciated
Cheers
Hi @cpatte7372 can you describe it a bit more what would you like to achieve? What do you mean by "Azure JSON" ?
Hi Piotrgo,
Thanks for getting back to me.
Basically, I would like to be able to convert Azure JSON files (script) to HCL TF.
Cheers
Hi Piotrgo,
When building resources in Azure, the resources are built in json file format see sample attached. I would like to be able to convert the json to HCL
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"networkInterfaces_adNic_name": {
"defaultValue": "adNic",
"type": "String"
},
"networkInterfaces_spNic_name": {
"defaultValue": "spNic",
"type": "String"
},
"networkInterfaces_sqlNic_name": {
"defaultValue": "sqlNic",
"type": "String"
},
"storageAccounts_olivia21_name": {
"defaultValue": "olivia21",
"type": "String"
},
"storageAccounts_olivia22_name": {
"defaultValue": "olivia22",
"type": "String"
},
"virtualMachines_spfarm_ad_name": {
"defaultValue": "spfarm-ad",
"type": "String"
},
"virtualMachines_spfarm_sp_name": {
"defaultValue": "spfarm-sp",
"type": "String"
},
"publicIPAddresses_namip34_name": {
"defaultValue": "namip34",
"type": "String"
},
"virtualMachines_spfarm_sql_name": {
"defaultValue": "spfarm-sql",
"type": "String"
},
"virtualNetworks_spfarmVNET_name": {
"defaultValue": "spfarmVNET",
"type": "String"
},
"loadBalancers_adLoadBalancer_name": {
"defaultValue": "adLoadBalancer",
"type": "String"
},
"loadBalancers_spLoadBalancer_name": {
"defaultValue": "spLoadBalancer",
"type": "String"
},
"publicIPAddresses_adpublicIP_name": {
"defaultValue": "adpublicIP",
"type": "String"
},
"loadBalancers_sqlLoadBalancer_name": {
"defaultValue": "sqlLoadBalancer",
"type": "String"
},
"publicIPAddresses_sqlpublicIP_name": {
"defaultValue": "sqlpublicIP",
"type": "String"
},
"availabilitySets_adAvailabiltySet_name": {
"defaultValue": "adAvailabiltySet",
"type": "String"
},
"availabilitySets_spAvailabiltySet_name": {
"defaultValue": "spAvailabiltySet",
"type": "String"
},
"availabilitySets_sqlAvailabiltySet_name": {
"defaultValue": "sqlAvailabiltySet",
"type": "String"
},
"subnets_adSubnet_name": {
"defaultValue": "adSubnet",
"type": "String"
},
"subnets_spSubnet_name": {
"defaultValue": "spSubnet",
"type": "String"
},
"subnets_sqlSubnet_name": {
"defaultValue": "sqlSubnet",
"type": "String"
},
"extensions_CreateSQLServer_name": {
"defaultValue": "CreateSQLServer",
"type": "String"
},
"extensions_ConfigureSPServer_name": {
"defaultValue": "ConfigureSPServer",
"type": "String"
},
"extensions_InstallDomainController_name": {
"defaultValue": "InstallDomainController",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/availabilitySets/adAvailabiltySet'.",
"type": "Microsoft.Compute/availabilitySets",
"sku": {
"name": "Classic"
},
"name": "[parameters('availabilitySets_adAvailabiltySet_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"platformUpdateDomainCount": 5,
"platformFaultDomainCount": 3,
"virtualMachines": [
{
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_ad_name'))]"
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/availabilitySets/spAvailabiltySet'.",
"type": "Microsoft.Compute/availabilitySets",
"sku": {
"name": "Classic"
},
"name": "[parameters('availabilitySets_spAvailabiltySet_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"platformUpdateDomainCount": 5,
"platformFaultDomainCount": 3,
"virtualMachines": [
{
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sp_name'))]"
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/availabilitySets/sqlAvailabiltySet'.",
"type": "Microsoft.Compute/availabilitySets",
"sku": {
"name": "Classic"
},
"name": "[parameters('availabilitySets_sqlAvailabiltySet_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"platformUpdateDomainCount": 5,
"platformFaultDomainCount": 3,
"virtualMachines": [
{
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sql_name'))]"
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-ad'.",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_spfarm_ad_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_adAvailabiltySet_name'))]"
},
"hardwareProfile": {
"vmSize": "Standard_DS2"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"name": "osdisk",
"createOption": "FromImage",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachines_spfarm_ad_name'),'-osdisk.vhd'))]"
},
"caching": "ReadWrite",
"diskSizeGB": 127
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('virtualMachines_spfarm_ad_name'),'-data-disk1')]",
"createOption": "Empty",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', '/vhds/ADDataDisk-1.vhd')]"
},
"caching": "None",
"diskSizeGB": 1000
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachines_spfarm_ad_name')]",
"adminUsername": "cpatte7372",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
},
"secrets": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_adNic_name'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('http', '://', parameters('storageAccounts_olivia22_name'), '.blob.core.windows.net', '/')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_adAvailabiltySet_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia21_name'))]",
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_adNic_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia22_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-sp'.",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_spfarm_sp_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_spAvailabiltySet_name'))]"
},
"hardwareProfile": {
"vmSize": "Standard_DS3"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftSharePoint",
"offer": "MicrosoftSharePointServer",
"sku": "2013",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"name": "osdisk",
"createOption": "FromImage",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachines_spfarm_sp_name'),'-osdisk.vhd'))]"
},
"caching": "ReadWrite",
"diskSizeGB": 127
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('virtualMachines_spfarm_sp_name'),'-data-disk1')]",
"createOption": "Empty",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachines_spfarm_sp_name'),'-SPDataDisk-1.vhd'))]"
},
"caching": "None",
"diskSizeGB": 1000
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachines_spfarm_sp_name')]",
"adminUsername": "cpatte7372",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
},
"secrets": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_spNic_name'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('http', '://', parameters('storageAccounts_olivia22_name'), '.blob.core.windows.net', '/')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_spAvailabiltySet_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia21_name'))]",
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_spNic_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia22_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-sql'.",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_spfarm_sql_name')]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_sqlAvailabiltySet_name'))]"
},
"hardwareProfile": {
"vmSize": "Standard_DS2"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftSQLServer",
"offer": "SQL2016-WS2016",
"sku": "SQLDEV",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"name": "osdisk",
"createOption": "FromImage",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachines_spfarm_sql_name'),'-osdisk.vhd'))]"
},
"caching": "ReadWrite",
"diskSizeGB": 127
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('virtualMachines_spfarm_sql_name'),'-data-disk1')]",
"createOption": "Empty",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', '/vhds/SQLDataDisk-1.vhd')]"
},
"caching": "None",
"diskSizeGB": 1000
},
{
"lun": 1,
"name": "[concat(parameters('virtualMachines_spfarm_sql_name'),'-log-disk1')]",
"createOption": "Empty",
"vhd": {
"uri": "[concat('http', '://', parameters('storageAccounts_olivia21_name'), '.blob.core.windows.net', '/vhds/SQLLogDisk-1.vhd')]"
},
"caching": "None",
"diskSizeGB": 1000
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachines_spfarm_sql_name')]",
"adminUsername": "cpatte7372",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
},
"secrets": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_sqlNic_name'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('http', '://', parameters('storageAccounts_olivia22_name'), '.blob.core.windows.net', '/')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_sqlAvailabiltySet_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia21_name'))]",
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_sqlNic_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_olivia22_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/loadBalancers/adLoadBalancer'.",
"type": "Microsoft.Network/loadBalancers",
"name": "[parameters('loadBalancers_adLoadBalancer_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "c71b59e4-986e-4813-a193-2f736a4f9218",
"frontendIPConfigurations": [
{
"name": "LBFE",
"etag": "W/\"d27097de-f167-4a6d-97aa-8c319d82762d\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_adpublicIP_name'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LBBE",
"etag": "W/\"d27097de-f167-4a6d-97aa-8c319d82762d\"",
"properties": {
"provisioningState": "Succeeded"
}
}
],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [
{
"name": "RDP",
"etag": "W/\"d27097de-f167-4a6d-97aa-8c319d82762d\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_adLoadBalancer_name'), '/frontendIPConfigurations/LBFE')]"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp"
}
}
],
"outboundNatRules": [],
"inboundNatPools": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_adpublicIP_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/loadBalancers/spLoadBalancer'.",
"type": "Microsoft.Network/loadBalancers",
"name": "[parameters('loadBalancers_spLoadBalancer_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "4727aff1-7923-485e-82b5-4ed585ad4e32",
"frontendIPConfigurations": [
{
"name": "LBFE",
"etag": "W/\"bb709fc5-3930-4dcc-9385-e106175e4789\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_namip34_name'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LBBE",
"etag": "W/\"bb709fc5-3930-4dcc-9385-e106175e4789\"",
"properties": {
"provisioningState": "Succeeded"
}
}
],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [
{
"name": "RDP",
"etag": "W/\"bb709fc5-3930-4dcc-9385-e106175e4789\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_id'), '/frontendIPConfigurations/LBFE')]"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp"
}
},
{
"name": "spWeb",
"etag": "W/\"bb709fc5-3930-4dcc-9385-e106175e4789\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_id_1'), '/frontendIPConfigurations/LBFE')]"
},
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp"
}
},
{
"name": "spCentralAdmin",
"etag": "W/\"bb709fc5-3930-4dcc-9385-e106175e4789\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "[[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_id_2'), '/frontendIPConfigurations/LBFE')]]"
},
"frontendPort": 8080,
"backendPort": 8080,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp"
}
}
],
"outboundNatRules": [],
"inboundNatPools": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_namip34_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/loadBalancers/sqlLoadBalancer'.",
"type": "Microsoft.Network/loadBalancers",
"name": "[parameters('loadBalancers_sqlLoadBalancer_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "57dc077a-5e8c-4f9d-82dc-2d6513b07e2e",
"frontendIPConfigurations": [
{
"name": "LBFE",
"etag": "W/\"c9e17506-5a26-473e-b72a-39d887820a62\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_sqlpublicIP_name'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LBBE",
"etag": "W/\"c9e17506-5a26-473e-b72a-39d887820a62\"",
"properties": {
"provisioningState": "Succeeded"
}
}
],
"loadBalancingRules": [],
"probes": [],
"inboundNatRules": [
{
"name": "RDP",
"etag": "W/\"c9e17506-5a26-473e-b72a-39d887820a62\"",
"properties": {
"provisioningState": "Succeeded",
"frontendIPConfiguration": {
"id": "[parameters('loadBalancers_sqlLoadBalancer_id')]"
},
"frontendPort": 3389,
"backendPort": 3389,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4,
"protocol": "Tcp"
}
}
],
"outboundNatRules": [],
"inboundNatPools": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_sqlpublicIP_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/networkInterfaces/adNic'.",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_adNic_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "38f57dc3-97c7-49de-bef9-3bcfba836a5d",
"ipConfigurations": [
{
"name": "ipconfig1",
"etag": "W/\"70ef7fd2-f40f-4217-9db3-57da084af9ee\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.0.4",
"privateIPAllocationMethod": "Static",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_spfarmVNET_name'), parameters('subnets_adSubnet_name'))]"
},
"primary": true,
"privateIPAddressVersion": "IPv4",
"loadBalancerBackendAddressPools": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_adLoadBalancer_name')), '/backendAddressPools/LBBE')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_adLoadBalancer_name')), '/inboundNatRules/RDP')]"
}
]
}
}
],
"dnsSettings": {
"dnsServers": [],
"appliedDnsServers": [],
"internalDomainNameSuffix": "zv54d4p2zcuuxpgkzssb2sfj3g.bx.internal.cloudapp.net"
},
"macAddress": "00-0D-3A-11-6A-80",
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"primary": true,
"virtualMachine": {
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_ad_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_spfarmVNET_name'))]",
"[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_adLoadBalancer_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/networkInterfaces/spNic'.",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_spNic_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "13d3ff55-c9f2-499c-b1ef-2b637f5d42b0",
"ipConfigurations": [
{
"name": "ipconfig1",
"etag": "W/\"5bc0c91d-c7af-410f-9758-7f5ac4a33322\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.2.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_spfarmVNET_name'), parameters('subnets_spSubnet_name'))]"
},
"primary": true,
"privateIPAddressVersion": "IPv4",
"loadBalancerBackendAddressPools": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_name')), '/backendAddressPools/LBBE')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_name')), '/inboundNatRules/RDP')]"
},
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_name')), '/inboundNatRules/spWeb')]"
},
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_name')), '/inboundNatRules/spCentralAdmin')]"
}
]
}
}
],
"dnsSettings": {
"dnsServers": [],
"appliedDnsServers": [],
"internalDomainNameSuffix": "zv54d4p2zcuuxpgkzssb2sfj3g.bx.internal.cloudapp.net"
},
"macAddress": "00-0D-3A-11-6A-BC",
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"primary": true,
"virtualMachine": {
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sp_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_spfarmVNET_name'))]",
"[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_spLoadBalancer_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/networkInterfaces/sqlNic'.",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_sqlNic_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.0.1.4",
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_spfarmVNET_name'), parameters('subnets_sqlSubnet_name'))]"
},
"primary": true,
"privateIPAddressVersion": "IPv4",
"loadBalancerBackendAddressPools": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_sqlLoadBalancer_name')), '/backendAddressPools/LBBE')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_sqlLoadBalancer_name')), '/inboundNatRules/RDP')]"
}
]
}
}
],
"dnsSettings": {
"dnsServers": [],
"appliedDnsServers": [],
"internalDomainNameSuffix": "zv54d4p2zcuuxpgkzssb2sfj3g.bx.internal.cloudapp.net"
},
"macAddress": "00-0D-3A-11-6B-89",
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"primary": true,
"virtualMachine": {
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sql_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_spfarmVNET_name'))]",
"[resourceId('Microsoft.Network/loadBalancers', parameters('loadBalancers_sqlLoadBalancer_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/publicIPAddresses/adpublicIP'.",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_adpublicIP_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/publicIPAddresses/namip34'.",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_namip34_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/publicIPAddresses/sqlpublicIP'.",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_sqlpublicIP_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Network/virtualNetworks/spfarmVNET'.",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworks_spfarmVNET_name')]",
"apiVersion": "2017-06-01",
"location": "eastus",
"scale": null,
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"subnets": [
{
"name": "adSubnet",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
},
{
"name": "sqlSubnet",
"properties": {
"addressPrefix": "10.0.1.0/24"
}
},
{
"name": "spSubnet",
"properties": {
"addressPrefix": "10.0.2.0/24"
}
}
],
"virtualNetworkPeerings": []
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/testgroup2/providers/Microsoft.Storage/storageAccounts/olivia21'.",
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "[parameters('storageAccounts_olivia21_name')]",
"apiVersion": "2016-01-01",
"location": "eastus",
"tags": {},
"scale": null,
"properties": {},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/testgroup2/providers/Microsoft.Storage/storageAccounts/olivia22'.",
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "[parameters('storageAccounts_olivia22_name')]",
"apiVersion": "2016-01-01",
"location": "eastus",
"tags": {},
"scale": null,
"properties": {},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-ad/extensions/InstallDomainController'.",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('virtualMachines_spfarm_ad_name'), '/', parameters('extensions_InstallDomainController_name'))]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.20",
"autoUpgradeMinorVersion": true,
"settings": {
"ModulesUrl": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/sharepoint-three-vm/dsc/CreateADPDC.ps1.zip",
"wmfVersion": "4.0",
"ConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC",
"Properties": {
"DomainName": "contoso.local",
"AdminCreds": {
"UserName": "cpatte7372",
"Password": "PrivateSettingsRef:AdminPassword"
}
}
},
"protectedSettings": {}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_ad_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-sp/extensions/ConfigureSPServer'.",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('virtualMachines_spfarm_sp_name'), '/', parameters('extensions_ConfigureSPServer_name'))]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.20",
"autoUpgradeMinorVersion": true,
"settings": {
"ModulesUrl": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/sharepoint-three-vm/dsc/PrepareSharePointServer.ps1.zip",
"wmfVersion": "4.0",
"ConfigurationFunction": "PrepareSharePointServer.ps1\\PrepareSharePointServer",
"Properties": {
"DNSServer": "10.0.0.4"
}
},
"protectedSettings": {}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sp_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/ad93eccc-eb31-42f2-9f79-0eaa6a8726a7/resourceGroups/TestGroup2/providers/Microsoft.Compute/virtualMachines/spfarm-sql/extensions/CreateSQLServer'.",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('virtualMachines_spfarm_sql_name'), '/', parameters('extensions_CreateSQLServer_name'))]",
"apiVersion": "2016-04-30-preview",
"location": "eastus",
"scale": null,
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.20",
"autoUpgradeMinorVersion": true,
"settings": {
"ModulesUrl": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/sharepoint-three-vm/dsc/PrepareSqlServer.ps1.zip",
"ConfigurationFunction": "PrepareSqlServer.ps1\\PrepareSqlServer",
"Properties": {
"DNSServer": "10.0.0.4"
}
},
"protectedSettings": {}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_spfarm_sql_name'))]"
]
}
]
}
json_format.txt
So guys the attached file was converted from HCL TF format to Azure JSON format
Is there way to convert back to HCL TF format?
Cheers
Azure JSON you're referring to is ARM template, Azure Resource Manager template.
There are no tools that will generate Terraform code based on ARM template.
Piotrgo.
I see. However, the HCL was converted to ARM template when I deployed the tf file to build resources in Azure.
The tf that created the json file is attached..
terraform_hcl_format.txt
@cpatte7372 the conversion is programmatic. Terraform calls this provider that in turn calls the Azure SDK for Go which in turn calls ARM. What is the scenario where you need to do this conversion?
Hey @cpatte7372
Thanks for opening this issue :)
As @piotrgo has commented, at this time there's no tooling to automatically convert from an ARM Template (the JSON above) to Terraform Configuration. Whilst Terraform does support Importing resources individually via the terraform import command - at this time it doesn't support generating the Terraform Configuration for each resource.
Instead I believe this may be better as a feature request to the Azure Portal - to be able to export the Terraform Configuration (and potentially the associated Terraform State) as you can ARM Templates and Parameters. @rcarun would you be able to comment on the best place to raise that kind of feature request?
Thanks!
Hi Tom
Thanks for getting back to me .
In that case I guess I will close this case.
Thanks
Oh, man.....having that capability in the portal would be amazing.....
closing this issue @cpatte7372's request
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!
Most helpful comment
Oh, man.....having that capability in the portal would be amazing.....