Skip to content

Commit

Permalink
Updating the App Service example to be complete
Browse files Browse the repository at this point in the history
This removes support for Publishing, since the SCM URL's aren't consistent across Sovereign Clouds (China/Germany/Govt etc)
Switches to using the new `default_site_hostname` field introduced in #612 rather than assuming what it is
  • Loading branch information
tombuildsstuff committed Dec 8, 2017
1 parent 65805ab commit 8b876ca
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 118 deletions.
23 changes: 0 additions & 23 deletions examples/app-service-asp-net/README.md

This file was deleted.

66 changes: 0 additions & 66 deletions examples/app-service-asp-net/app.tf

This file was deleted.

29 changes: 0 additions & 29 deletions examples/app-service-asp-net/variables.tf

This file was deleted.

Binary file removed examples/app-service-asp-net/web-package.zip
Binary file not shown.
15 changes: 15 additions & 0 deletions examples/app-service/README.md
Original file line number Diff line number Diff line change
@@ -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`
54 changes: 54 additions & 0 deletions examples/app-service/app.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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}"
}
21 changes: 21 additions & 0 deletions examples/app-service/variables.tf
Original file line number Diff line number Diff line change
@@ -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 | ...
}

0 comments on commit 8b876ca

Please sign in to comment.