Skip to content

Commit

Permalink
Merge pull request #407 from metadevpro/app-service-asp-net-sample
Browse files Browse the repository at this point in the history
Provision sample for ASP.NET on azure_rm_app_service
  • Loading branch information
tombuildsstuff authored Dec 8, 2017
2 parents f717de2 + 10633c6 commit a3b207f
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
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`
50 changes: 50 additions & 0 deletions examples/app-service/app.tf
Original file line number Diff line number Diff line change
@@ -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}"
}
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 a3b207f

Please sign in to comment.