diff --git a/examples/app-service/README.md b/examples/app-service/README.md new file mode 100644 index 000000000000..38309b79b4e5 --- /dev/null +++ b/examples/app-service/README.md @@ -0,0 +1,15 @@ +# Azure App Service Sample + +Sample to deploy an App Service within an App Service Plan. + +## Creates + +1. A Resource Group +2. An [App Service Plan](https://docs.microsoft.com/en-us/azure/app-service/azure-web-sites-web-hosting-plans-in-depth-overview) +3. An [App Service](https://azure.microsoft.com/en-gb/services/app-service/) configured for usage with .NET 4.x Application + +## Usage + +- Provide values to all variables (credentials and names). +- Create with `terraform apply` +- Destroy all with `terraform destroy --force` diff --git a/examples/app-service/app.tf b/examples/app-service/app.tf new file mode 100644 index 000000000000..d2cf74a13484 --- /dev/null +++ b/examples/app-service/app.tf @@ -0,0 +1,50 @@ +# Configure the Microsoft Azure Provider +provider "azurerm" { + # if you're using a Service Principal (shared account) then either set the environment variables, or fill these in: # subscription_id = "..." # client_id = "..." # client_secret = "..." # tenant_id = "..." +} + +resource "azurerm_resource_group" "default" { + name = "${var.resource_group_name}" + location = "${var.location}" +} + +resource "azurerm_app_service_plan" "default" { + name = "${var.app_service_name}-plan" + location = "${azurerm_resource_group.default.location}" + resource_group_name = "${azurerm_resource_group.default.name}" + + sku { + tier = "${var.app_service_plan_sku_tier}" + size = "${var.app_service_plan_sku_size}" + } +} + +resource "azurerm_app_service" "default" { + name = "${var.app_service_name}" + location = "${azurerm_resource_group.default.location}" + resource_group_name = "${azurerm_resource_group.default.name}" + app_service_plan_id = "${azurerm_app_service_plan.default.id}" + + site_config { + dotnet_framework_version = "v4.0" + remote_debugging_enabled = true + remote_debugging_version = "VS2015" + } + + # app_settings { + # "SOME_KEY" = "some-value" + # } + # connection_string { + # name = "Database" + # type = "SQLServer" + # value = "Server=some-server.mydomain.com;Integrated Security=SSPI" + # } +} + +output "app_service_name" { + value = "${azurerm_app_service.default.name}" +} + +output "app_service_default_hostname" { + value = "https://${azurerm_app_service.default.default_site_hostname}" +} diff --git a/examples/app-service/variables.tf b/examples/app-service/variables.tf new file mode 100644 index 000000000000..6d9f8e8d18d8 --- /dev/null +++ b/examples/app-service/variables.tf @@ -0,0 +1,21 @@ +variable "resource_group_name" { + type = "string" +} + +variable "location" { + type = "string" +} + +variable "app_service_name" { + type = "string" +} + +variable "app_service_plan_sku_tier" { + type = "string" + default = "Basic" # Basic | Standard | ... +} + +variable "app_service_plan_sku_size" { + type = "string" + default = "B1" # B1 | S1 | ... +}