Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. resource "azurerm_virtual_machine_scale_set" "sf_scale_set_app" {
  2. count = "${var.is_sf_cluster_required}"
  3. name = "app"
  4. location = "${var.location}"
  5. resource_group_name = "${azurerm_resource_group.fusion.name}"
  6.  
  7. automatic_os_upgrade = true
  8. upgrade_policy_mode = "Automatic"
  9. health_probe_id = "${azurerm_lb_probe.sf_lb_probe_gateway_app.id}"
  10.  
  11. sku {
  12. name = "${var.sf_scale_set_app_config["name"]}"
  13. tier = "${var.sf_scale_set_app_config["tier"]}"
  14. capacity = "${var.sf_scale_set_app_config["capacity"]}"
  15. }
  16.  
  17. storage_profile_image_reference {
  18. publisher = "Canonical"
  19. offer = "UbuntuServer"
  20. sku = "16.04"
  21. version = "6.0.12"
  22. }
  23.  
  24. storage_profile_os_disk {
  25. name = ""
  26. caching = "ReadWrite"
  27. create_option = "FromImage"
  28. managed_disk_type = "Standard_LRS"
  29. }
  30.  
  31. os_profile_secrets = [
  32. {
  33. source_vault_id = "${var.sf_vault_id}"
  34.  
  35. vault_certificates = [
  36. {
  37. certificate_url = "${var.sf_vault_url}"
  38. certificate_store = "My"
  39. },
  40. ]
  41. },
  42. ]
  43.  
  44. storage_profile_data_disk {
  45. lun = 0
  46. caching = "ReadWrite"
  47. create_option = "Empty"
  48. disk_size_gb = 40
  49. }
  50.  
  51. os_profile {
  52. computer_name_prefix = "app"
  53. admin_username = "someuser"
  54. custom_data = "${data.template_file.cloud_init_config_app.rendered}"
  55. }
  56.  
  57. os_profile_linux_config {
  58. disable_password_authentication = true
  59.  
  60. ssh_keys {
  61. path = "/home/someuser/.ssh/authorized_keys"
  62. key_data = "${file("sshkeys/someuser.pub")}"
  63. }
  64. }
  65.  
  66. network_profile {
  67. name = "sf-vm-net-profile-${terraform.workspace}"
  68. primary = true
  69.  
  70. ip_configuration {
  71. name = "sf-ip-config-app-${terraform.workspace}"
  72. primary = true
  73. subnet_id = "${azurerm_subnet.sf_vnet_subnet.id}"
  74. load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.sf_lb_be_app.id}"]
  75. load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_pool.sf_nat_app.*.id, count.index)}"]
  76. }
  77. }
  78.  
  79. extension {
  80. name = "sf-scale-set-extension-${terraform.workspace}"
  81. publisher = "Microsoft.Azure.ServiceFabric"
  82. type = "ServiceFabricLinuxNode"
  83. type_handler_version = "1.0"
  84. settings = "{ "certificate": { "thumbprint": "${var.cert_thumbprint}", "x509StoreName": "My" } , "clusterEndpoint": "${azurerm_service_fabric_cluster.sf_service.cluster_endpoint}", "nodeTypeRef": "app", "durabilityLevel": "${var.sf_reliability}","nicPrefixOverride": "${azurerm_subnet.sf_vnet_subnet.address_prefix}","enableParallelJobs": "true"}"
  85. protected_settings = "{"StorageAccountKey1": "${azurerm_storage_account.sf_storage.primary_access_key}", "StorageAccountKey2": "${azurerm_storage_account.sf_storage.secondary_access_key}"}"
  86. }
  87.  
  88. data "template_file" "cloud_init_config_app" {
  89. count = "${var.is_sf_cluster_required}"
  90. template = "${file("customscripts/cloud_init.sh")}"
  91.  
  92. vars {
  93. azure_tenant_id = "771c9c47-7f24-44dc-958e-34f8713a8394"
  94. azure_client_id = "${var.client_id}"
  95. azure_client_secret = "${var.client_secret}"
  96. }
  97. }
  98.  
  99. resource "azurerm_storage_account" "sf_storage" {
  100. count = "${var.is_sf_cluster_required}"
  101. name = "${replace(replace(lower(terraform.workspace), "-", ""), " ", "")}-sf-diag-${substr(random_id.server.hex,0,4)}"
  102. resource_group_name = "${azurerm_resource_group.fusion.name}"
  103. location = "${azurerm_resource_group.fusion.location}"
  104. account_tier = "Standard"
  105. account_kind = "StorageV2"
  106. account_replication_type = "LRS"
  107. }
  108.  
  109. ------------------------------------------------------------------------
  110.  
  111. Error: Error running plan: 2 error(s) occurred:
  112.  
  113. * azurerm_virtual_machine_scale_set.sf_scale_set_app: 1 error(s) occurred:
  114.  
  115. * azurerm_virtual_machine_scale_set.sf_scale_set_app: Resource 'azurerm_storage_account.sf_storage' not found for variable 'azurerm_storage_account.sf_storage.primary_access_key'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement