-
Notifications
You must be signed in to change notification settings - Fork 77
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
Configure and deploy an Azure App Service #74
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1560daf
Add App Service to Azure using Terraform Templates
manojvazirani 915db60
Add App Service under App Service Plan module
manojvazirani 21f6622
Merge branch 'mavazira/features/appsvc' of github.com:Microsoft/entre…
manojvazirani c2ae75c
Remove additional files for app-service created
manojvazirani 75349a7
Add public Ip and load balancer to app service
manojvazirani 8f06b15
Merge branch 'master' of github.com:Microsoft/entref-appservice-conta…
manojvazirani 9956e8f
Add svcplan changes and optional settings to appsvc
manojvazirani abbf4cb
Integrate review comments related to naming of resources
manojvazirani 9ae78d9
Resolve merge issues with master
manojvazirani f0b3190
Remove Optional and Required from variables.tf
manojvazirani e023a40
Update variables.tf
manojvazirani 0f58958
App service acts as load balancer
manojvazirani d5eee4e
Merge branch 'mavazira/features/appsvc' of github.com:Microsoft/entre…
manojvazirani 5731e96
Add App Service as an independent module
manojvazirani caad189
Merge branch 'master' of github.com:Microsoft/entref-appservice-conta…
manojvazirani 8c5160d
Fix Merge conflicts
manojvazirani d9a5c17
Add multiple App Service Deployment Changes
manojvazirani a990bea
Add type for every variable in variables.tf
manojvazirani cf12dea
Merge branch 'master' of github.com:Microsoft/entref-appservice-conta…
manojvazirani 4c4348b
Update to documentation for usage
manojvazirani 2b8c7df
Integrate review comments for Docker credentials
manojvazirani d2215f7
Create app service map with image tags
manojvazirani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
## Azure App Service | ||
|
||
Build, deploy, and scale enterprise-grade web, mobile, and API apps running on any platform. Meet rigorous performance, scalability, security and compliance requirements while using a fully managed platform to perform infrastructure maintenance. | ||
|
||
More information for Azure App Services can be found [here](https://azure.microsoft.com/en-us/services/app-service/) | ||
|
||
Cobalt gives ability to specify following settings for App Service based on the requirements: | ||
- name : The name of the App Services to be created. This is a map of app service name and the linux_fx_version/container image to be loaded for that app service. DOCKER|<user/image:tag> | ||
- service_plan_resource_group_name : The Name of the Resource Group where the Service Plan exists. | ||
- app_service_plan_id : The ID of the App Service Plan within which the App Service exists is populated automatically based on service plan. | ||
- tags : A mapping of tags to assign to the resource. | ||
- app_settings : A key-value pair of App Settings. Settings for private Container Registries | ||
- DOCKER_REGISTRY_SERVER_URL : The docker registry server URL for app service to be created | ||
- DOCKER_REGISTRY_SERVER_USERNAME : The docker registry server usernames for app services to be created | ||
- DOCKER_REGISTRY_SERVER_PASSWORD : The docker registry server passwords for app services to be created | ||
- site_config : | ||
- always_on : Should the app be loaded at all times? Defaults to false. | ||
- virtual_network_name : The name of the Virtual Network which this App Service should be attached to. | ||
|
||
Please click the [link](https://www.terraform.io/docs/providers/azurerm/d/app_service.html) to get additional details on settings in Terraform for Azure App Service. | ||
|
||
## Usage | ||
erikschlegel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Module Definitions | ||
|
||
The App Service is dependent on deployment of Service Plan. Make sure to deploy Service Plan before starting to deploy App Services. | ||
|
||
- Service Plan Module : infra/modules/providers/azure/service-plan | ||
- App Service Module : infra/modules/providers/azure/app-service | ||
|
||
``` | ||
variable "resource_group_name" { | ||
value = "test-rg" | ||
} | ||
variable "service_plan_name" { | ||
value = "test-svcplan" | ||
} | ||
variable "app_service_name" { | ||
value = { | ||
appservice1="DOCKER|<user1/image1:tag1>" | ||
appservice2="DOCKER|<user2/image2:tag2>" | ||
} | ||
} | ||
module "service_plan" { | ||
resource_group_name = "${var.resource_group_name}" | ||
resource_group_location = "${var.resource_group_location}" | ||
service_plan_name = "${var.service_plan_name}" | ||
} | ||
module "app_service" { | ||
service_plan_resource_group_name = "${var.resource_group_name}" | ||
service_plan_name = "${var.service_plan_name}" | ||
``` | ||
|
||
## Outputs | ||
|
||
Once the deployments are completed successfully, the output for the current module will be in the format mentioned below: | ||
|
||
``` | ||
Outputs: | ||
app_service_uri = [ | ||
appservice1.azurewebsites.net, | ||
appservice2.azurewebsites.net | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
data "azurerm_resource_group" "appsvc" { | ||
name = "${var.service_plan_resource_group_name}" | ||
} | ||
|
||
data "azurerm_app_service_plan" "appsvc" { | ||
name = "${var.service_plan_name}" | ||
resource_group_name = "${data.azurerm_resource_group.appsvc.name}" | ||
} | ||
|
||
resource "azurerm_app_service" "appsvc" { | ||
name = "${element(keys(var.app_service_name), count.index)}" | ||
resource_group_name = "${data.azurerm_resource_group.appsvc.name}" | ||
location = "${data.azurerm_resource_group.appsvc.location}" | ||
app_service_plan_id = "${data.azurerm_app_service_plan.appsvc.id}" | ||
tags = "${var.resource_tags}" | ||
count = "${length(keys(var.app_service_name))}" | ||
|
||
app_settings { | ||
DOCKER_REGISTRY_SERVER_URL = "${var.docker_registry_server_url}" | ||
DOCKER_REGISTRY_SERVER_USERNAME = "${var.docker_registry_server_username}" | ||
DOCKER_REGISTRY_SERVER_PASSWORD = "${var.docker_registry_server_password}" | ||
} | ||
|
||
site_config { | ||
linux_fx_version = "${element(values(var.app_service_name), count.index)}" | ||
always_on = "${var.site_config_always_on}" | ||
virtual_network_name = "${var.site_config_vnet_name}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
output "app_service_uri" { | ||
description = "The URL of the app service created" | ||
value = "${azurerm_app_service.appsvc.*.default_site_hostname}" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
variable "service_plan_resource_group_name" { | ||
description = "The name of the resource group in which the service plan was created." | ||
type = "string" | ||
} | ||
|
||
variable "service_plan_name" { | ||
description = "The name of the service plan" | ||
erikschlegel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type = "string" | ||
} | ||
|
||
variable "resource_tags" { | ||
description = "Map of tags to apply to taggable resources in this module. By default the taggable resources are tagged with the name defined above and this map is merged in" | ||
type = "map" | ||
default = {} | ||
} | ||
|
||
variable "app_service_name" { | ||
description = "The name of the app service to be created" | ||
type = "map" | ||
default = {} | ||
} | ||
|
||
variable "docker_registry_server_url" { | ||
description = "The docker registry server URL for app service to be created" | ||
type = "string" | ||
default = "index.docker.io" | ||
} | ||
|
||
variable "docker_registry_server_username" { | ||
description = "The docker registry server username for app service to be created" | ||
type = "string" | ||
default = "" | ||
} | ||
|
||
variable "docker_registry_server_password" { | ||
description = "The docker registry server password for app service to be created" | ||
type = "string" | ||
default = "" | ||
} | ||
|
||
variable "site_config_always_on" { | ||
description = "Should the app be loaded at all times? Defaults to false." | ||
type = "string" | ||
default = "false" | ||
} | ||
|
||
variable "site_config_vnet_name" { | ||
description = "Should the app be loaded at all times? Defaults to false." | ||
type = "string" | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,4 +65,4 @@ resource "null_resource" "example" { | |
command = "execute shell script" | ||
} | ||
} | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ provider "null" { | |
|
||
provider "azuread" { | ||
version = "~>0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General note, please update the usage section of the readme for the service plan module so that cobalt users have more context on how to define and configure there module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let me open a new PR with the documentation changes for service plan.