You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.9KB

  1. resource "random_string" "this" {
  2. length = 4
  3. upper = false
  4. special = false
  5. }
  6. module "resource_group_demo" {
  7. source = "git::https://scm.dazzlingwrench.fxinnovation.com/fxinnovation-public/terraform-module-azurerm-resource-group.git?ref=1.0.0"
  8. location = "francecentral"
  9. name = "tftest${random_string.this.result}"
  10. tags = {
  11. managed_by = "Terraform"
  12. EndDate = "2020-05-25"
  13. }
  14. }
  15. resource "azurerm_virtual_network" "example" {
  16. name = "tftest${random_string.this.result}"
  17. address_space = ["10.0.0.0/16"]
  18. location = "francecentral"
  19. resource_group_name = module.resource_group_demo.name
  20. }
  21. resource "azurerm_subnet" "example" {
  22. name = "tftest${random_string.this.result}"
  23. resource_group_name = module.resource_group_demo.name
  24. virtual_network_name = azurerm_virtual_network.example.name
  25. address_prefixes = ["10.0.0.0/24"]
  26. }
  27. resource "azurerm_network_interface" "example" {
  28. name = "tftest${random_string.this.result}"
  29. location = module.resource_group_demo.location
  30. resource_group_name = module.resource_group_demo.name
  31. ip_configuration {
  32. name = "internal"
  33. subnet_id = azurerm_subnet.example.id
  34. private_ip_address_allocation = "Dynamic"
  35. }
  36. }
  37. resource "azurerm_windows_virtual_machine" "example" {
  38. name = "tftest${random_string.this.result}"
  39. resource_group_name = module.resource_group_demo.name
  40. location = module.resource_group_demo.location
  41. size = "Standard_F2"
  42. admin_username = "adminuser"
  43. admin_password = "P@$$w0rd1234!"
  44. network_interface_ids = [
  45. azurerm_network_interface.example.id,
  46. ]
  47. os_disk {
  48. caching = "ReadWrite"
  49. storage_account_type = "Standard_LRS"
  50. }
  51. source_image_reference {
  52. publisher = "MicrosoftWindowsServer"
  53. offer = "WindowsServer"
  54. sku = "2016-Datacenter"
  55. version = "latest"
  56. }
  57. }
  58. module "example" {
  59. source = "../"
  60. resource_group_name = module.resource_group_demo.name
  61. resource_group_location = module.resource_group_demo.location
  62. storage_account_name = "tftest${random_string.this.result}"
  63. account_tier = "standard"
  64. account_replication_type = "LRS"
  65. enable_https_traffic_only = true
  66. log_analytics_workspace_name = "tftest${random_string.this.result}"
  67. workspace_sku = "free"
  68. retention_in_days = 1
  69. diagnostics_count = 1
  70. names = ["tftest${random_string.this.result}"]
  71. target_resource_ids = ["${azurerm_windows_virtual_machine.example.id}"]
  72. metrics = [
  73. [
  74. {
  75. category = "AllMetrics"
  76. enabled = true
  77. retention_policy = [
  78. {
  79. enabled = false
  80. days = 1
  81. }
  82. ]
  83. }
  84. ]
  85. ]
  86. log_analytics_destination_type = ["Dedicated"]
  87. }