Advertisement
Guest User

Untitled

a guest
Aug 4th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. provider "azurerm" {}
  2.  
  3. #########
  4. # group #
  5. #########
  6.  
  7. module "resource_group" {
  8. source = "github.com/zot24/tf_azure_resource_group"
  9.  
  10. name = "${var.app_name}_${var.resource_group_name}"
  11. location = "${var.location}"
  12. }
  13.  
  14. ############
  15. # security #
  16. ############
  17.  
  18. module "network_security_group" {
  19. source = "github.com/zot24/tf_azure_network_security_group"
  20.  
  21. name = "${var.app_name}_${var.security_group_name}"
  22. location = "${var.location}"
  23. resource_group_name = "${module.resource_group.name}"
  24. }
  25.  
  26. module "sr_web" {
  27. source = "github.com/zot24/tf_azure_network_security_rules//sr_web"
  28.  
  29. priority = "${var.sr_web_priority}"
  30. resource_group_name = "${module.resource_group.name}"
  31. network_security_group_name = "${module.network_security_group.name}"
  32. }
  33.  
  34. module "sr_registry" {
  35. source = "github.com/zot24/tf_azure_network_security_rules//sr_registry"
  36.  
  37. priority = "${var.sr_registry_priority}"
  38. resource_group_name = "${module.resource_group.name}"
  39. network_security_group_name = "${module.network_security_group.name}"
  40. }
  41.  
  42. ###########
  43. # network #
  44. ###########
  45.  
  46. module "virtual_network" {
  47. source = "github.com/zot24/tf_azure_virtual_network"
  48.  
  49. name = "${var.app_name}_${var.virtual_network_name}"
  50. location = "${var.location}"
  51. resource_group_name = "${module.resource_group.name}"
  52. address_space = "${var.address_space}"
  53. }
  54.  
  55. module "subnet" {
  56. source = "github.com/zot24/tf_azure_subnet"
  57.  
  58. name = "${var.app_name}_${var.subnet_name}"
  59. resource_group_name = "${module.resource_group.name}"
  60. virtual_network_name = "${module.virtual_network.name}"
  61. network_security_group_id = "${module.network_security_group.id}"
  62. address_prefix = "${var.address_prefix}"
  63. }
  64.  
  65. module "public_ip" {
  66. source = "github.com/zot24/tf_azure_public_ip"
  67.  
  68. name = "${var.app_name}_${var.public_ip_name}"
  69. location = "${var.location}"
  70. resource_group_name = "${module.resource_group.name}"
  71. public_ip_allocation = "${var.public_ip_allocation}"
  72. }
  73.  
  74. module "network_interface" {
  75. source = "github.com/zot24/tf_azure_network_interface"
  76.  
  77. name = "${var.app_name}_${var.network_interface_name}"
  78. location = "${var.location}"
  79. resource_group_name = "${module.resource_group.name}"
  80. network_security_group_id = "${module.network_security_group.id}"
  81.  
  82. ip_configuration_name = "${var.app_name}_${var.ip_configuration_name}"
  83. ip_configuration_subnet_id = "${module.subnet.id}"
  84. ip_private_allocation = "${var.ip_private_allocation}"
  85. ip_public_id = "${module.public_ip.id}"
  86. }
  87.  
  88. resource "null_resource" "ansible_hosts" {
  89. provisioner "local-exec" {
  90. command = "echo '[${var.app_name}]\\n${module.public_ip.ip_address}' > ../ansible/hosts"
  91. }
  92. }
  93.  
  94. ###########
  95. # storage #
  96. ###########
  97.  
  98. module "storage_account" {
  99. source = "github.com/zot24/tf_azure_storage_account"
  100.  
  101. name = "${var.app_name}${var.storage_account_name}"
  102. location = "${var.location}"
  103. resource_group_name = "${module.resource_group.name}"
  104. account_type = "${var.account_type}"
  105. }
  106.  
  107. module "storage_container" {
  108. source = "github.com/zot24/tf_azure_storage_container"
  109.  
  110. name = "${var.app_name}${var.storage_container_name}"
  111. resource_group_name = "${module.resource_group.name}"
  112. storage_account_name = "${module.storage_account.name}"
  113. container_access_type = "${var.container_access_type}"
  114. }
  115.  
  116. module "storage_blob" {
  117. source = "github.com/zot24/tf_azure_storage_blob"
  118.  
  119. name = "${var.app_name}-${var.storage_blob_name}"
  120. resource_group_name = "${module.resource_group.name}"
  121. storage_account_name = "${module.storage_account.name}"
  122. storage_container_name = "${module.storage_container.name}"
  123. size = "${var.size}"
  124. }
  125.  
  126. ###################
  127. # virtual machine #
  128. ###################
  129.  
  130. module "virtual_machine" {
  131. source = "github.com/zot24/tf_azure_virtual_machine//with_data_disk"
  132.  
  133. name = "${var.app_name}_${var.vm_name}"
  134. location = "${var.location}"
  135. resource_group_name = "${module.resource_group.name}"
  136. network_interface_ids = "${module.network_interface.id}"
  137. vm_size = "${var.vm_size}"
  138.  
  139. image_publisher = "${var.image_publisher}"
  140. image_offer = "${var.image_offer}"
  141. image_sku = "${var.image_sku}"
  142. image_version = "${var.image_version}"
  143.  
  144. os_disk_name = "${var.app_name}_${var.os_disk_name}"
  145. os_disk_vhd_uri = "${module.storage_account.primary_blob_endpoint}${module.storage_container.name}/${var.app_name}-${var.os_disk_vhd_uri_name}.vhd"
  146. os_disk_caching = "${var.os_disk_caching}"
  147. os_disk_create_option = "${var.os_disk_create_option}"
  148.  
  149. data_disk_name = "${var.app_name}_${var.data_disk_name}"
  150. data_disk_vhd_uri = "${module.storage_account.primary_blob_endpoint}${module.storage_container.name}/${module.storage_blob.name}"
  151. data_disk_create_option = "${var.data_disk_create_option}"
  152. data_disk_size_gb = "${var.data_disk_size_gb}"
  153. data_disk_lun = "${var.data_disk_lun}"
  154.  
  155. os_profile_computer_name = "${var.os_profile_computer_name}"
  156. os_profile_username = "${var.os_profile_username}"
  157. os_profile_password = "${var.os_profile_password}"
  158.  
  159. disable_password_authentication = "${var.disable_password_authentication}"
  160. ssh_keys_path = "/home/${var.os_profile_username}/.ssh/authorized_keys"
  161. ssh_keys_key_data = "${file("${var.ssh_keys_key_data_path}")}"
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement