github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/examples/azure-wordpress-mysql-replication/website.tf (about)

     1  # ********************** WEBSITE DEPLOYMENT TEMPLATE ********************** #
     2  
     3  resource "azurerm_template_deployment" "website" {
     4    name                = "website"
     5    resource_group_name = "${azurerm_resource_group.rg.name}"
     6    depends_on          = ["azurerm_virtual_machine_extension.setup_mysql"]
     7  
     8    template_body = <<DEPLOY
     9  {  
    10     "$schema":"http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    11     "contentVersion":"1.0.0.0",
    12     "parameters":{  
    13        "siteName":{  
    14           "type":"string",
    15           "defaultValue":"${var.site_name}"
    16        },
    17        "hostingPlanName":{  
    18           "type":"string",
    19           "defaultValue":"${var.hosting_plan_name}"
    20        },
    21        "sku":{  
    22           "type":"string",
    23           "allowedValues":[  
    24              "Free",
    25              "Shared",
    26              "Basic",
    27              "Standard",
    28              "Premium"
    29           ],
    30           "defaultValue":"${var.sku}"
    31        },
    32        "workerSize":{  
    33           "type":"string",
    34           "allowedValues":[  
    35              "0",
    36              "1",
    37              "2"
    38           ],
    39           "defaultValue":"${var.worker_size}"
    40        },
    41        "dbServer":{  
    42           "type":"string",
    43           "defaultValue":"${var.dns_name}.${azurerm_resource_group.rg.location}.cloudapp.azure.com:${var.mysql_front_end_port_0}"
    44        },
    45        "dbName":{  
    46           "type":"string",
    47           "defaultValue":"${var.unique_prefix}wordpress"
    48        },
    49        "dbAdminPassword":{  
    50           "type":"string",
    51           "defaultValue":"${var.mysql_root_password}"
    52        }
    53     },
    54     "variables":{  
    55        "connectionString":"[concat('Database=', parameters('dbName'), ';Data Source=', parameters('dbServer'), ';User Id=admin;Password=', parameters('dbAdminPassword'))]",
    56        "repoUrl":"https://github.com/azureappserviceoss/wordpress-azure",
    57        "branch":"master",
    58        "workerSize":"[parameters('workerSize')]",
    59        "sku":"[parameters('sku')]",
    60        "hostingPlanName":"[parameters('hostingPlanName')]"
    61     },
    62     "resources":[  
    63        {  
    64           "apiVersion":"2014-06-01",
    65           "name":"[variables('hostingPlanName')]",
    66           "type":"Microsoft.Web/serverfarms",
    67           "location":"[resourceGroup().location]",
    68           "properties":{  
    69              "name":"[variables('hostingPlanName')]",
    70              "sku":"[variables('sku')]",
    71              "workerSize":"[variables('workerSize')]",
    72              "hostingEnvironment":"",
    73              "numberOfWorkers":0
    74           }
    75        },
    76        {  
    77           "apiVersion":"2015-02-01",
    78           "name":"[parameters('siteName')]",
    79           "type":"Microsoft.Web/sites",
    80           "location":"[resourceGroup().location]",
    81           "tags":{  
    82              "[concat('hidden-related:', '/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', variables('hostingPlanName'))]":"empty"
    83           },
    84           "dependsOn":[  
    85              "[concat('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]"
    86           ],
    87           "properties":{  
    88              "name":"[parameters('siteName')]",
    89              "serverFarmId":"[concat('/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', variables('hostingPlanName'))]",
    90              "hostingEnvironment":""
    91           },
    92           "resources":[  
    93              {  
    94                 "apiVersion":"2015-04-01",
    95                 "name":"connectionstrings",
    96                 "type":"config",
    97                 "dependsOn":[  
    98                    "[concat('Microsoft.Web/Sites/', parameters('siteName'))]"
    99                 ],
   100                 "properties":{  
   101                    "defaultConnection":{  
   102                       "value":"[variables('connectionString')]",
   103                       "type":"MySQL"
   104                    }
   105                 }
   106              },
   107              {  
   108                 "apiVersion":"2015-04-01",
   109                 "name":"web",
   110                 "type":"config",
   111                 "dependsOn":[  
   112                    "[concat('Microsoft.Web/Sites/', parameters('siteName'))]"
   113                 ],
   114                 "properties":{  
   115                    "phpVersion":"5.6"
   116                 }
   117              },
   118              {  
   119                 "apiVersion":"2015-08-01",
   120                 "name":"web",
   121                 "type":"sourcecontrols",
   122                 "dependsOn":[  
   123                    "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]",
   124                    "[concat('Microsoft.Web/Sites/', parameters('siteName'), '/config/connectionstrings')]",
   125                    "[concat('Microsoft.Web/Sites/', parameters('siteName'), '/config/web')]"
   126                 ],
   127                 "properties":{  
   128                    "RepoUrl":"[variables('repoUrl')]",
   129                    "branch":"[variables('branch')]",
   130                    "IsManualIntegration":true
   131                 }
   132              }
   133           ]
   134        }      
   135     ]
   136  }
   137  DEPLOY
   138  
   139    deployment_mode = "Incremental"
   140  }