Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provision sample for ASP.NET on azure_rm_app_service #407

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ...
}