Created
February 21, 2019 13:15
-
-
Save kongou-ae/bf49faaccab5f99f33e9defd530ff507 to your computer and use it in GitHub Desktop.
50vmsOnAzureStack.tf
This file contains hidden or 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
variable "count" { | |
default = "50" | |
} | |
provider "azurestack" { | |
arm_endpoint = "https://management.local.azurestack.external" | |
subscription_id = "" | |
client_id = "" | |
client_secret = "" | |
tenant_id = "" | |
} | |
resource "azurestack_resource_group" "test" { | |
name = "capatest" | |
location = "local" | |
} | |
resource "azurestack_virtual_network" "test" { | |
name = "acctvn" | |
address_space = ["10.0.0.0/16"] | |
location = "${azurestack_resource_group.test.location}" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
} | |
resource "azurestack_subnet" "test" { | |
name = "acctsub" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
virtual_network_name = "${azurestack_virtual_network.test.name}" | |
address_prefix = "10.0.2.0/24" | |
} | |
resource "azurestack_network_interface" "test" { | |
name = "acctnic${count.index}" | |
location = "${azurestack_resource_group.test.location}" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
count = "${var.count}" | |
ip_configuration { | |
name = "testconfiguration${count.index}" | |
subnet_id = "${azurestack_subnet.test.id}" | |
private_ip_address_allocation = "dynamic" | |
} | |
} | |
resource "azurestack_storage_account" "test" { | |
name = "accsa${count.index}" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
location = "${azurestack_resource_group.test.location}" | |
account_tier = "Standard" | |
account_replication_type = "LRS" | |
count = "${var.count}" | |
tags { | |
environment = "staging" | |
} | |
} | |
resource "azurestack_storage_container" "test" { | |
name = "vhds" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
storage_account_name = "${element(azurestack_storage_account.test.*.name, count.index)}" | |
container_access_type = "private" | |
} | |
resource "azurestack_virtual_machine" "test" { | |
name = "acctvm${count.index}" | |
location = "${azurestack_resource_group.test.location}" | |
resource_group_name = "${azurestack_resource_group.test.name}" | |
network_interface_ids = ["${element(azurestack_network_interface.test.*.id, count.index)}"] | |
vm_size = "Standard_F1" | |
count = "${var.count}" | |
storage_image_reference { | |
publisher = "Canonical" | |
offer = "UbuntuServer" | |
sku = "18.04-LTS" | |
version = "latest" | |
} | |
storage_os_disk { | |
name = "myosdisk1" | |
vhd_uri = "${element(azurestack_storage_account.test.*.primary_blob_endpoint,count.index)}${azurestack_storage_container.test.name}/myosdisk1.vhd" | |
caching = "ReadWrite" | |
create_option = "FromImage" | |
} | |
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