mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
working Terraform configuration for a VM w/ data disk
This commit is contained in:
parent
218c1ca4b4
commit
efe7669b58
12
azure/starter-vm/terraform/network-interface1.tf
Normal file
12
azure/starter-vm/terraform/network-interface1.tf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
resource "azurerm_network_interface" "bdb_node_NIC_1" {
|
||||||
|
name = "bdb_node_NIC_1"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
|
||||||
|
ip_configuration {
|
||||||
|
name = "bdb_node_IP_config_1"
|
||||||
|
subnet_id = "${azurerm_subnet.bdb_node_subnet_1.id}"
|
||||||
|
private_ip_address_allocation = "dynamic"
|
||||||
|
public_ip_address_id = "${azurerm_public_ip.bdb_node_IP_1.id}"
|
||||||
|
}
|
||||||
|
}
|
||||||
20
azure/starter-vm/terraform/network-security-group1.tf
Normal file
20
azure/starter-vm/terraform/network-security-group1.tf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Azure Network Security Group docs:
|
||||||
|
# https://www.terraform.io/docs/providers/azurerm/r/network_security_group.html
|
||||||
|
# https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-nsg
|
||||||
|
resource "azurerm_network_security_group" "bdb_node_NSG_1" {
|
||||||
|
name = "bdb_node_NSG_1"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
|
||||||
|
security_rule {
|
||||||
|
name = "ssh"
|
||||||
|
priority = 100
|
||||||
|
direction = "Inbound"
|
||||||
|
access = "Allow"
|
||||||
|
protocol = "Tcp" # Tcp, Udp, or * for both
|
||||||
|
source_port_range = "*"
|
||||||
|
destination_port_range = "22"
|
||||||
|
source_address_prefix = "*"
|
||||||
|
destination_address_prefix = "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
azure/starter-vm/terraform/public_ip1.tf
Normal file
10
azure/starter-vm/terraform/public_ip1.tf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
resource "azurerm_public_ip" "bdb_node_IP_1" {
|
||||||
|
name = "bdb_node_IP_1"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
public_ip_address_allocation = "static"
|
||||||
|
}
|
||||||
|
|
||||||
|
output "bdb_node_IP_1" {
|
||||||
|
value = "${azurerm_public_ip.bdb_node_IP_1.ip_address}"
|
||||||
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
# Create a resource group
|
resource "azurerm_resource_group" "bdb_node_RG" {
|
||||||
resource "azurerm_resource_group" "bdbNodeRG" {
|
name = "bdb_node_RG"
|
||||||
name = "bdbNodeRG"
|
|
||||||
location = "${var.location}"
|
location = "${var.location}"
|
||||||
}
|
}
|
||||||
|
|||||||
6
azure/starter-vm/terraform/storage-account.tf
Normal file
6
azure/starter-vm/terraform/storage-account.tf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
resource "azurerm_storage_account" "bdb_node_SA" {
|
||||||
|
name = "bdbnodestorageaccount"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
account_type = "Standard_LRS"
|
||||||
|
}
|
||||||
6
azure/starter-vm/terraform/storage-container1.tf
Normal file
6
azure/starter-vm/terraform/storage-container1.tf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
resource "azurerm_storage_container" "bdb_node_SC_1" {
|
||||||
|
name = "bdbnodestoragecontainer1"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
storage_account_name = "${azurerm_storage_account.bdb_node_SA.name}"
|
||||||
|
container_access_type = "private"
|
||||||
|
}
|
||||||
7
azure/starter-vm/terraform/subnet1.tf
Normal file
7
azure/starter-vm/terraform/subnet1.tf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
resource "azurerm_subnet" "bdb_node_subnet_1" {
|
||||||
|
name = "bdb_node_subnet_1"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
virtual_network_name = "${azurerm_virtual_network.bdb_node_VN_1.name}"
|
||||||
|
address_prefix = "10.0.2.0/24"
|
||||||
|
network_security_group_id = "${azurerm_network_security_group.bdb_node_NSG_1.id}"
|
||||||
|
}
|
||||||
@ -1,7 +1,14 @@
|
|||||||
# Use this file for Terraform variables that:
|
# Use this file for Terraform variables that:
|
||||||
# 1) you don't mind sharing with the world on GitHub (if default provided) or
|
# 1) you don't mind sharing with the world on GitHub (if default provided) or
|
||||||
# 2) you want Terraform to ask the user for at runtime (if no default provided)
|
# 2) you want Terraform to ask the user for at runtime (if no default provided)
|
||||||
# Secret variables should be put in secret.tfvars or similar.
|
|
||||||
|
# Secret variables should be put in secret.tfvars with the following contents:
|
||||||
|
# subscription_id = "..."
|
||||||
|
# client_id = "..."
|
||||||
|
# client_secret = "..."
|
||||||
|
# tenant_id = "..."
|
||||||
|
# The secret.tfvars file will be read if you use:
|
||||||
|
# $ terraform <subcommand> -var-file="secret.tfvars"
|
||||||
|
|
||||||
variable "location" {
|
variable "location" {
|
||||||
default = "westeurope"
|
default = "westeurope"
|
||||||
|
|||||||
41
azure/starter-vm/terraform/virtual-machine1.tf
Normal file
41
azure/starter-vm/terraform/virtual-machine1.tf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
variable "vm1_admin_password" {}
|
||||||
|
|
||||||
|
resource "azurerm_virtual_machine" "bdb_node_VM_1" {
|
||||||
|
name = "bdb_node_VM_1"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
network_interface_ids = ["${azurerm_network_interface.bdb_node_NIC_1.id}"]
|
||||||
|
vm_size = "Standard_A2_v2"
|
||||||
|
|
||||||
|
storage_image_reference {
|
||||||
|
publisher = "Canonical"
|
||||||
|
offer = "UbuntuServer"
|
||||||
|
sku = "16.04-LTS"
|
||||||
|
version = "latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
storage_os_disk {
|
||||||
|
name = "vm1osdisk1"
|
||||||
|
vhd_uri = "${azurerm_storage_account.bdb_node_SA.primary_blob_endpoint}${azurerm_storage_container.bdb_node_SC_1.name}/vm1osdisk1.vhd"
|
||||||
|
caching = "ReadWrite"
|
||||||
|
create_option = "FromImage"
|
||||||
|
}
|
||||||
|
|
||||||
|
storage_data_disk {
|
||||||
|
name = "vm1datadisk1"
|
||||||
|
vhd_uri = "${azurerm_storage_account.bdb_node_SA.primary_blob_endpoint}${azurerm_storage_container.bdb_node_SC_1.name}/vm1datadisk1.vhd"
|
||||||
|
disk_size_gb = "30"
|
||||||
|
create_option = "empty"
|
||||||
|
lun = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
os_profile {
|
||||||
|
computer_name = "vm1"
|
||||||
|
admin_username = "vm1admin"
|
||||||
|
admin_password = "${var.vm1_admin_password}"
|
||||||
|
}
|
||||||
|
|
||||||
|
os_profile_linux_config {
|
||||||
|
disable_password_authentication = false
|
||||||
|
}
|
||||||
|
}
|
||||||
6
azure/starter-vm/terraform/virtual-network1.tf
Normal file
6
azure/starter-vm/terraform/virtual-network1.tf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
resource "azurerm_virtual_network" "bdb_node_VN_1" {
|
||||||
|
name = "bdb_node_VN_1"
|
||||||
|
location = "${var.location}"
|
||||||
|
resource_group_name = "${azurerm_resource_group.bdb_node_RG.name}"
|
||||||
|
address_space = ["10.0.0.0/16"]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user