Skip to content

Commit bf9ca0f

Browse files
authored
ftp fixes, linux new storage fixes (#75)
1 parent ad0a0e1 commit bf9ca0f

22 files changed

Lines changed: 469 additions & 74 deletions

File tree

examples/basic_auth/README.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
# Default example
3+
4+
This deploys the module in its simplest form with FTP state configured to FTPS only and basic authentication toggled on.
5+
If you have any policies denying / auditing App Services that use basic authentication / local authentication, beware that configuration may not persist.
6+
7+
```hcl
8+
terraform {
9+
required_version = ">= 1.3.0"
10+
required_providers {
11+
azurerm = {
12+
source = "hashicorp/azurerm"
13+
version = ">= 3.7.0, < 4.0.0"
14+
}
15+
random = {
16+
source = "hashicorp/random"
17+
version = ">= 3.5.0, < 4.0.0"
18+
}
19+
}
20+
}
21+
22+
# tflint-ignore: terraform_module_provider_declaration, terraform_output_separate, terraform_variable_separate
23+
provider "azurerm" {
24+
features {
25+
resource_group {
26+
prevent_deletion_if_contains_resources = false
27+
}
28+
}
29+
}
30+
31+
32+
## Section to provide a random Azure region for the resource group
33+
# This allows us to randomize the region for the resource group.
34+
module "regions" {
35+
source = "Azure/regions/azurerm"
36+
version = ">= 0.3.0"
37+
}
38+
39+
# This allows us to randomize the region for the resource group.
40+
resource "random_integer" "region_index" {
41+
max = length(local.azure_regions) - 1
42+
min = 0
43+
}
44+
## End of section to provide a random Azure region for the resource group
45+
46+
# This ensures we have unique CAF compliant names for our resources.
47+
module "naming" {
48+
source = "Azure/naming/azurerm"
49+
version = ">= 0.3.0"
50+
}
51+
52+
# This is required for resource modules
53+
resource "azurerm_resource_group" "example" {
54+
location = local.azure_regions[random_integer.region_index.result]
55+
name = module.naming.resource_group.name_unique
56+
}
57+
58+
/*
59+
module "avm_res_storage_storageaccount" {
60+
source = "Azure/avm-res-storage-storageaccount/azurerm"
61+
version = "0.1.1"
62+
63+
enable_telemetry = false
64+
name = module.naming.storage_account.name_unique
65+
resource_group_name = azurerm_resource_group.example.name
66+
shared_access_key_enabled = true
67+
public_network_access_enabled = true
68+
network_rules = {
69+
bypass = ["AzureServices"]
70+
default_action = "Allow"
71+
}
72+
}
73+
*/
74+
75+
/*
76+
resource "azurerm_service_plan" "example" {
77+
location = azurerm_resource_group.example.location
78+
# This will equate to Consumption (Serverless) in portal
79+
name = module.naming.app_service_plan.name_unique
80+
os_type = "Windows"
81+
resource_group_name = azurerm_resource_group.example.name
82+
sku_name = "Y1"
83+
}
84+
*/
85+
86+
module "test" {
87+
source = "../../"
88+
89+
# source = "Azure/avm-res-web-site/azurerm"
90+
# version = "0.6.1"
91+
92+
enable_telemetry = var.enable_telemetry
93+
94+
name = "${module.naming.function_app.name_unique}-default"
95+
resource_group_name = azurerm_resource_group.example.name
96+
location = azurerm_resource_group.example.location
97+
98+
kind = "functionapp"
99+
os_type = "Linux"
100+
101+
site_config = {
102+
ftps_state = "FtpsOnly"
103+
}
104+
105+
106+
/*
107+
# Uses an existing app service plan
108+
os_type = azurerm_service_plan.example.os_type
109+
service_plan_resource_id = azurerm_service_plan.example.id
110+
*/
111+
112+
# Creates a new app service plan
113+
create_service_plan = true
114+
new_service_plan = {
115+
sku_name = "S1"
116+
}
117+
118+
/*
119+
# Uses an existing storage account
120+
storage_account_name = module.avm_res_storage_storageaccount.name
121+
storage_account_access_key = module.avm_res_storage_storageaccount.resource.primary_access_key
122+
*/
123+
124+
# Uses the avm-res-storage-storageaccount module to create a new storage account within root module
125+
function_app_create_storage_account = true
126+
function_app_storage_account = {
127+
name = module.naming.storage_account.name_unique
128+
resource_group_name = azurerm_resource_group.example.name
129+
}
130+
}
131+
```
132+
133+
<!-- markdownlint-disable MD033 -->
134+
## Requirements
135+
136+
The following requirements are needed by this module:
137+
138+
- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.3.0)
139+
140+
- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 3.7.0, < 4.0.0)
141+
142+
- <a name="requirement_random"></a> [random](#requirement\_random) (>= 3.5.0, < 4.0.0)
143+
144+
## Providers
145+
146+
The following providers are used by this module:
147+
148+
- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.7.0, < 4.0.0)
149+
150+
- <a name="provider_random"></a> [random](#provider\_random) (>= 3.5.0, < 4.0.0)
151+
152+
## Resources
153+
154+
The following resources are used by this module:
155+
156+
- [azurerm_resource_group.example](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) (resource)
157+
- [random_integer.region_index](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) (resource)
158+
159+
<!-- markdownlint-disable MD013 -->
160+
## Required Inputs
161+
162+
No required inputs.
163+
164+
## Optional Inputs
165+
166+
The following input variables are optional (have default values):
167+
168+
### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry)
169+
170+
Description: This variable controls whether or not telemetry is enabled for the module.
171+
For more information see <https://aka.ms/avm/telemetryinfo>.
172+
If it is set to false, then no telemetry will be collected.
173+
174+
Type: `bool`
175+
176+
Default: `true`
177+
178+
## Outputs
179+
180+
The following outputs are exported:
181+
182+
### <a name="output_name"></a> [name](#output\_name)
183+
184+
Description: This is the full output for the resource.
185+
186+
### <a name="output_resource"></a> [resource](#output\_resource)
187+
188+
Description: This is the full output for the resource.
189+
190+
### <a name="output_service_plan"></a> [service\_plan](#output\_service\_plan)
191+
192+
Description: Full output of service plan created
193+
194+
### <a name="output_storage_account"></a> [storage\_account](#output\_storage\_account)
195+
196+
Description: Full output of storage account created
197+
198+
## Modules
199+
200+
The following Modules are called:
201+
202+
### <a name="module_naming"></a> [naming](#module\_naming)
203+
204+
Source: Azure/naming/azurerm
205+
206+
Version: >= 0.3.0
207+
208+
### <a name="module_regions"></a> [regions](#module\_regions)
209+
210+
Source: Azure/regions/azurerm
211+
212+
Version: >= 0.3.0
213+
214+
### <a name="module_test"></a> [test](#module\_test)
215+
216+
Source: ../../
217+
218+
Version:
219+
220+
<!-- markdownlint-disable-next-line MD041 -->
221+
## Data Collection
222+
223+
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
224+
<!-- END_TF_DOCS -->

examples/basic_auth/_footer.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!-- markdownlint-disable-next-line MD041 -->
2+
## Data Collection
3+
4+
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

examples/basic_auth/_header.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Default example
2+
3+
This deploys the module in its simplest form with FTP state configured to FTPS only and basic authentication toggled on.
4+
If you have any policies denying / auditing App Services that use basic authentication / local authentication, beware that configuration may not persist.

examples/basic_auth/locals.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
locals {
2+
azure_regions = [
3+
"eastus",
4+
"westeurope",
5+
"eastasia",
6+
"japaneast"
7+
]
8+
}

examples/basic_auth/main.tf

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
terraform {
2+
required_version = ">= 1.3.0"
3+
required_providers {
4+
azurerm = {
5+
source = "hashicorp/azurerm"
6+
version = ">= 3.7.0, < 4.0.0"
7+
}
8+
random = {
9+
source = "hashicorp/random"
10+
version = ">= 3.5.0, < 4.0.0"
11+
}
12+
}
13+
}
14+
15+
# tflint-ignore: terraform_module_provider_declaration, terraform_output_separate, terraform_variable_separate
16+
provider "azurerm" {
17+
features {
18+
resource_group {
19+
prevent_deletion_if_contains_resources = false
20+
}
21+
}
22+
}
23+
24+
25+
## Section to provide a random Azure region for the resource group
26+
# This allows us to randomize the region for the resource group.
27+
module "regions" {
28+
source = "Azure/regions/azurerm"
29+
version = ">= 0.3.0"
30+
}
31+
32+
# This allows us to randomize the region for the resource group.
33+
resource "random_integer" "region_index" {
34+
max = length(local.azure_regions) - 1
35+
min = 0
36+
}
37+
## End of section to provide a random Azure region for the resource group
38+
39+
# This ensures we have unique CAF compliant names for our resources.
40+
module "naming" {
41+
source = "Azure/naming/azurerm"
42+
version = ">= 0.3.0"
43+
}
44+
45+
# This is required for resource modules
46+
resource "azurerm_resource_group" "example" {
47+
location = local.azure_regions[random_integer.region_index.result]
48+
name = module.naming.resource_group.name_unique
49+
}
50+
51+
/*
52+
module "avm_res_storage_storageaccount" {
53+
source = "Azure/avm-res-storage-storageaccount/azurerm"
54+
version = "0.1.1"
55+
56+
enable_telemetry = false
57+
name = module.naming.storage_account.name_unique
58+
resource_group_name = azurerm_resource_group.example.name
59+
shared_access_key_enabled = true
60+
public_network_access_enabled = true
61+
network_rules = {
62+
bypass = ["AzureServices"]
63+
default_action = "Allow"
64+
}
65+
}
66+
*/
67+
68+
/*
69+
resource "azurerm_service_plan" "example" {
70+
location = azurerm_resource_group.example.location
71+
# This will equate to Consumption (Serverless) in portal
72+
name = module.naming.app_service_plan.name_unique
73+
os_type = "Windows"
74+
resource_group_name = azurerm_resource_group.example.name
75+
sku_name = "Y1"
76+
}
77+
*/
78+
79+
module "test" {
80+
source = "../../"
81+
82+
# source = "Azure/avm-res-web-site/azurerm"
83+
# version = "0.6.1"
84+
85+
enable_telemetry = var.enable_telemetry
86+
87+
name = "${module.naming.function_app.name_unique}-default"
88+
resource_group_name = azurerm_resource_group.example.name
89+
location = azurerm_resource_group.example.location
90+
91+
kind = "functionapp"
92+
os_type = "Linux"
93+
94+
site_config = {
95+
ftps_state = "FtpsOnly"
96+
}
97+
98+
99+
/*
100+
# Uses an existing app service plan
101+
os_type = azurerm_service_plan.example.os_type
102+
service_plan_resource_id = azurerm_service_plan.example.id
103+
*/
104+
105+
# Creates a new app service plan
106+
create_service_plan = true
107+
new_service_plan = {
108+
sku_name = "S1"
109+
}
110+
111+
/*
112+
# Uses an existing storage account
113+
storage_account_name = module.avm_res_storage_storageaccount.name
114+
storage_account_access_key = module.avm_res_storage_storageaccount.resource.primary_access_key
115+
*/
116+
117+
# Uses the avm-res-storage-storageaccount module to create a new storage account within root module
118+
function_app_create_storage_account = true
119+
function_app_storage_account = {
120+
name = module.naming.storage_account.name_unique
121+
resource_group_name = azurerm_resource_group.example.name
122+
}
123+
}

examples/basic_auth/outputs.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
output "name" {
2+
description = "This is the full output for the resource."
3+
value = module.test.name
4+
}
5+
6+
output "resource" {
7+
description = "This is the full output for the resource."
8+
sensitive = true
9+
value = module.test.resource
10+
}
11+
12+
output "service_plan" {
13+
description = "Full output of service plan created"
14+
value = module.test.service_plan
15+
}
16+
17+
output "storage_account" {
18+
description = "Full output of storage account created"
19+
sensitive = true
20+
value = module.test.storage_account
21+
}

0 commit comments

Comments
 (0)