-
Notifications
You must be signed in to change notification settings - Fork 920
Adding example for web app running on docker #115
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
Open
xiaxyi
wants to merge
4
commits into
Azure:master
Choose a base branch
from
xiaxyi:webApp/docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
11 changes: 11 additions & 0 deletions
11
quickstart/201-web-app-on-docker-container/.terraform-docs.yml
This file contains hidden or 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,11 @@ | ||
| formatter: "markdown table" | ||
|
|
||
| content: |- | ||
| {{ .Resources }} | ||
| {{ .Inputs }} | ||
| {{ .Providers }} | ||
| {{ .Requirements }} | ||
|
|
||
| output: | ||
| file: readme.html.markdown | ||
| mode: inject |
This file contains hidden or 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,71 @@ | ||
| /* | ||
| THIS FILE IS GENERATED BY TFMOD-SCAFFOLD, PLEASE DO NOT MODIFY IT. | ||
| IF YOU WANT TO USE A CUSTOMIZED CONFIGURATION, PLEASE CREATE YOUR OWN AND | ||
| SET THIS FILE'S PATH TO $TFLINT_CONFIG ENVVIRONMENT VARIABLE. | ||
| */ | ||
|
|
||
| plugin "azurerm" { | ||
| enabled = true | ||
| version = "0.18.0" | ||
| source = "github.com/terraform-linters/tflint-ruleset-azurerm" | ||
| } | ||
|
|
||
| rule "terraform_comment_syntax" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_deprecated_index" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_deprecated_interpolation" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_documented_outputs" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_documented_variables" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_module_pinned_source" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_module_version" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_naming_convention" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_required_providers" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_required_version" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_standard_module_structure" { | ||
| enabled = false | ||
| } | ||
|
|
||
| rule "terraform_typed_variables" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_unused_declarations" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_unused_required_providers" { | ||
| enabled = true | ||
| } | ||
|
|
||
| rule "terraform_workspace_remote" { | ||
| enabled = true | ||
| } |
This file contains hidden or 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,80 @@ | ||
| resource "azurerm_resource_group" "default" { | ||
| name = "${var.name_prefix}-rg" | ||
| location = var.location | ||
| } | ||
|
|
||
| resource "azurerm_user_assigned_identity" "default" { | ||
| name = "${var.name_prefix}-uai" | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| location = azurerm_resource_group.default.location | ||
| } | ||
|
|
||
| resource "azurerm_container_registry" "default" { | ||
| name = "${var.name_prefix}acr" | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| location = azurerm_resource_group.default.location | ||
| sku = "Premium" | ||
| identity { | ||
| type = "UserAssigned" | ||
| identity_ids = [ | ||
| azurerm_user_assigned_identity.default.id | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| resource "azurerm_service_plan" "default_linux" { | ||
| name = "${var.name_prefix}-sp-linux" | ||
| location = azurerm_resource_group.default.location | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| sku_name = "P1v3" | ||
| os_type = "Linux" | ||
| } | ||
|
|
||
| resource "azurerm_service_plan" "default_windows" { | ||
| name = "${var.name_prefix}-sp-windows" | ||
| location = azurerm_resource_group.default.location | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| sku_name = "P1v3" | ||
| os_type = "Windows" | ||
| } | ||
|
|
||
| # when setting docker container for web app, please use app_setting block to specify the container registry information such as URL and credentials, instead of docker_container_registry property in application_stack block. Service will try to locate the docker image based on linuxFxVersion/ windowsFxVersion property and they are composed following the format: DOCKER|containerRegistry/containerName:containerTag in terraform provider. | ||
| resource "azurerm_linux_web_app" "default" { | ||
| name = "${var.name_prefix}-lwa" | ||
| location = azurerm_resource_group.default.location | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| service_plan_id = azurerm_service_plan.default_linux.id | ||
| app_settings = { | ||
| "DOCKER_REGISTRY_SERVER_URL" = "https://${azurerm_container_registry.default.name}.azurecr.io" | ||
| "DOCKER_REGISTRY_SERVER_USERNAME" = "" | ||
| "DOCKER_REGISTRY_SERVER_PASSWORD" = "" | ||
| "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" | ||
| } | ||
| site_config { | ||
| application_stack { | ||
| docker_image = "testimage" | ||
| docker_image_tag = "latest" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| resource "azurerm_windows_web_app" "default" { | ||
| name = "${var.name_prefix}-wwa" | ||
| location = azurerm_resource_group.default.location | ||
| resource_group_name = azurerm_resource_group.default.name | ||
| service_plan_id = azurerm_service_plan.default_windows.id | ||
| app_settings = { | ||
| "DOCKER_REGISTRY_SERVER_URL" = "https://index.docker.io" | ||
| "DOCKER_REGISTRY_SERVER_USERNAME" = "" | ||
| "DOCKER_REGISTRY_SERVER_PASSWORD" = "" | ||
| "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" | ||
| } | ||
| site_config { | ||
| application_stack { | ||
| docker_container_name = "testimage" | ||
| docker_container_tag = "latest" | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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,13 @@ | ||
| terraform { | ||
| required_version = ">=1.0" | ||
|
|
||
| required_providers { | ||
| azurerm = { | ||
| source = "hashicorp/azurerm" | ||
| version = "~>3.8" | ||
| } | ||
| } | ||
| } | ||
| provider "azurerm" { | ||
| features {} | ||
| } |
46 changes: 46 additions & 0 deletions
46
quickstart/201-web-app-on-docker-container/readme.html.markdown
This file contains hidden or 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,46 @@ | ||
| # Azure Windows/ Linux Web App running on Docker Container | ||
|
|
||
| This template deploys an Azure Function App running on Docker Container | ||
|
|
||
| <!-- Run the following commands on your Windows machine to update document --> | ||
| <!-- docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest terraform-docs markdown table --output-file readme.html.markdown --output-mode inject ./ --> | ||
| <!-- docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest markdown-table-formatter readme.html.markdown --> | ||
| <!-- Run the following command to lint Terraform code with tflint --> | ||
| <!-- docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest tflint --config=.tflint.hcl --> | ||
| <!-- Run the following command to lint Terraform code with Checkov --> | ||
| <!-- docker run --rm -v ${pwd}:/src -w /src mcr.microsoft.com/azterraform:latest checkov --skip-framework dockerfile --quiet -d ./ --> | ||
| <!-- --> | ||
| <!-- BEGIN_TF_DOCS --> | ||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |--------------------------------------------------------------------------------------------------------------------------------------------------|----------| | ||
| | [azurerm_container_registry.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/container_registry) | resource | | ||
| | [azurerm_linux_web_app.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_web_app) | resource | | ||
| | [azurerm_resource_group.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | | ||
| | [azurerm_service_plan.default_linux](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/service_plan) | resource | | ||
| | [azurerm_service_plan.default_windows](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/service_plan) | resource | | ||
| | [azurerm_user_assigned_identity.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity) | resource | | ||
| | [azurerm_windows_web_app.default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/windows_web_app) | resource | | ||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |-----------------------------------------------------------------------|---------------------------------------|----------|---------------|:--------:| | ||
| | <a name="input_location"></a> [location](#input\_location) | Location to deploy the resource group | `string` | `"West US 2"` | no | | ||
| | <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Prefix of the resource name | `string` | n/a | yes | | ||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |---------------------------------------------------------------|---------| | ||
| | <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~>3.8 | | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |---------------------------------------------------------------------------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.0 | | ||
| | <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~>3.8 | | ||
| <!-- END_TF_DOCS --> | ||
|
|
||
| ## Example | ||
|
|
||
| To see how to run this example, see [Create an Azure Function App using Terraform](https://docs.microsoft.com/azure/developer/terraform/create-azure-windows-linux-web-app-running-on-docker-container). |
This file contains hidden or 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,10 @@ | ||
| variable "name_prefix" { | ||
| type = string | ||
| description = "Prefix of the resource name" | ||
| } | ||
|
|
||
| variable "location" { | ||
| type = string | ||
| description = "Location to deploy the resource group" | ||
| default = "West US 2" | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.