Created
April 19, 2017 15:06
-
-
Save dobrerazvan/b4a6bfbf1c6648b20ae0aad39dd6ac74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure the Microsoft Azure Provider | |
provider "azurerm" { | |
subscription_id = "" | |
client_id = "" | |
client_secret = "" | |
tenant_id = "" | |
} | |
resource "azurerm_resource_group" "test" { | |
name = "acctestrg" | |
location = "eastus" | |
} | |
resource "azurerm_virtual_network" "test" { | |
name = "acctvn" | |
address_space = ["10.0.0.0/16"] | |
location = "eastus" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
} | |
resource "azurerm_subnet" "test" { | |
name = "acctsub" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
virtual_network_name = "${azurerm_virtual_network.test.name}" | |
address_prefix = "10.0.2.0/24" | |
} | |
resource "azurerm_network_interface" "test" { | |
name = "acctni" | |
location = "eastus" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
ip_configuration { | |
name = "testconfiguration1" | |
subnet_id = "${azurerm_subnet.test.id}" | |
private_ip_address_allocation = "dynamic" | |
} | |
} | |
resource "azurerm_managed_disk" "test" { | |
name = "datadisk_existing" | |
location = "eastus" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
storage_account_type = "Standard_LRS" | |
create_option = "Empty" | |
disk_size_gb = "1023" | |
} | |
resource "azurerm_virtual_machine" "test" { | |
name = "acctvm" | |
location = "eastus" | |
resource_group_name = "${azurerm_resource_group.test.name}" | |
network_interface_ids = ["${azurerm_network_interface.test.id}"] | |
vm_size = "Standard_DS1_v2" | |
storage_os_disk { | |
name = "myosdisk1" | |
caching = "ReadWrite" | |
create_option = "FromImage" | |
managed_disk_type = "Standard_LRS" | |
image_uri = "https://campaigncustomvhd.blob.core.windows.net/system/Microsoft.Compute/Images/images-centos/packer-centos-osDisk.6e4dbbd2-d147-494c-a83a-43b7a307a55f.vhd" | |
os_type = "linux" | |
} | |
storage_data_disk { | |
name = "datadisk_new" | |
managed_disk_type = "Standard_LRS" | |
create_option = "Empty" | |
lun = 0 | |
disk_size_gb = "1023" | |
} | |
storage_data_disk { | |
name = "${azurerm_managed_disk.test.name}" | |
managed_disk_id = "${azurerm_managed_disk.test.id}" | |
create_option = "Attach" | |
lun = 1 | |
disk_size_gb = "${azurerm_managed_disk.test.disk_size_gb}" | |
} | |
os_profile { | |
computer_name = "hostname" | |
admin_username = "testadmin" | |
admin_password = "Password1234!" | |
} | |
os_profile_linux_config { | |
disable_password_authentication = false | |
} | |
tags { | |
environment = "staging" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment