Skip to content

Commit

Permalink
updates for v0.1.0, for AVM team review (#22)
Browse files Browse the repository at this point in the history
* feat: add code for app managed environment

* docs: update readme header

* fix: addressing comments in PR & running avmfix

* fix: unused vars

* docs: add internal load balancer example & update docs

* docs: improve the name of the managed resource group in the example

* fix: align variable definitions with azurerm & governance fixes, contributes to #9.

* fix: errors from e2e tests

* fix: missing diagnostics resource causing linting issues

* add storage and dapr components (#19)

* AVM alignment tasks for app managed environment (#11)

* feat: add code for app managed environment

* docs: update readme header

* fix: addressing comments in PR & running avmfix

* fix: unused vars

* docs: add internal load balancer example & update docs

* docs: improve the name of the managed resource group in the example

* fix: align variable definitions with azurerm & governance fixes, contributes to #9.

* fix: errors from e2e tests

* fix: missing diagnostics resource causing linting issues

---------

Co-authored-by: Sebastian Graef <segraef@microsoft.com>

* feat: adjust outputs to align with azurerm specification

* fix: allow local in outputs as it is output related

* chore: add my own E2E file so i can test

* fix: stop trying to be fancy with the jsondecode

* fix: azapi data source

* fix: update output to account for optional params

* fix: add workload profile outputs

* fix: output format to deal with optional elements

* fix: condition type

* fix: grept apply (#16)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: updates to outputs

* fix: output format for workload profiles

* chore: replace e2e workflow with Azure version

* feat: add storage & dapr component

* chore: switch to github runner

* fix: attribute values for dapr & storage components

* fix: use a unique name for the storage account

* chore: docs

* fix: attribute & type corrections

* fix: align dapr component name with requirements

* feat: add outputs for storages & dapr_components

* chore: add back in long running examples & Azure e2e workflow

---------

Co-authored-by: Sebastian Graef <segraef@microsoft.com>
Co-authored-by: Matt White <16320656+matt-FFFFFF@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix conflict in dev (#20)

* AVM alignment tasks for app managed environment (#11)

* feat: add code for app managed environment

* docs: update readme header

* fix: addressing comments in PR & running avmfix

* fix: unused vars

* docs: add internal load balancer example & update docs

* docs: improve the name of the managed resource group in the example

* fix: align variable definitions with azurerm & governance fixes, contributes to #9.

* fix: errors from e2e tests

* fix: missing diagnostics resource causing linting issues

---------

Co-authored-by: Sebastian Graef <segraef@microsoft.com>

* fix: grept apply (#16)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: duplciated output

---------

Co-authored-by: Sebastian Graef <segraef@microsoft.com>
Co-authored-by: Matt White <16320656+matt-FFFFFF@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: Sebastian Graef <segraef@microsoft.com>
Co-authored-by: Matt White <16320656+matt-FFFFFF@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 12, 2024
1 parent 6f9e632 commit fbae279
Show file tree
Hide file tree
Showing 22 changed files with 779 additions and 27 deletions.
101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ The following providers are used by this module:

The following resources are used by this module:

- [azapi_resource.dapr_components](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) (resource)
- [azapi_resource.storages](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) (resource)
- [azapi_resource.this_environment](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) (resource)
- [azurerm_management_lock.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_lock) (resource)
- [azurerm_monitor_diagnostic_setting.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) (resource)
- [azurerm_resource_group_template_deployment.telemetry](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group_template_deployment) (resource)
- [azurerm_role_assignment.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) (resource)
- [random_id.telem](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) (resource)
- [azapi_resource.this_environment](https://registry.terraform.io/providers/Azure/azapi/latest/docs/data-sources/resource) (data source)
- [azurerm_resource_group.parent](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) (data source)

<!-- markdownlint-disable MD013 -->
Expand Down Expand Up @@ -86,6 +89,63 @@ Type: `string`

Default: `null`

### <a name="input_dapr_components"></a> [dapr\_components](#input\_dapr\_components)

Description: - `component_type` - (Required) The Dapr Component Type. For example `state.azure.blobstorage`. Changing this forces a new resource to be created.
- `ignore_errors` - (Optional) Should the Dapr sidecar to continue initialisation if the component fails to load. Defaults to `false`
- `init_timeout` - (Optional) The timeout for component initialisation as a `ISO8601` formatted string. e.g. `5s`, `2h`, `1m`. Defaults to `5s`.
- `secret_store_component` - (Optional) Name of a Dapr component to retrieve component secrets from.
- `scopes` - (Optional) A list of scopes to which this component applies.
- `version` - (Required) The version of the component.

---
`metadata` block supports the following:
- `name` - (Required) The name of the Metadata configuration item.
- `secret_name` - (Optional) The name of a secret specified in the `secrets` block that contains the value for this metadata configuration item.
- `value` - (Optional) The value for this metadata configuration item.

---
`secret` block supports the following:
- `name` - (Required) The Secret name.
- `value` - (Required) The value for this secret.

---
`timeouts` block supports the following:
- `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Dapr Component.
- `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Dapr Component.
- `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Dapr Component.
- `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Dapr Component.

Type:

```hcl
map(object({
component_type = string
ignore_errors = optional(bool, true)
init_timeout = optional(string)
secret_store_component = optional(string)
scopes = optional(list(string))
version = string
metadata = optional(list(object({
name = string
secret_name = optional(string)
value = optional(string)
})))
secret = optional(set(object({
name = string
value = string
})))
timeouts = optional(object({
create = optional(string)
delete = optional(string)
read = optional(string)
update = optional(string)
}))
}))
```

Default: `{}`

### <a name="input_diagnostic_settings"></a> [diagnostic\_settings](#input\_diagnostic\_settings)

Description: A map of diagnostic settings to create on the Key Vault. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
Expand Down Expand Up @@ -240,6 +300,39 @@ map(object({

Default: `{}`

### <a name="input_storages"></a> [storages](#input\_storages)

Description: - `access_key` - (Required) The Storage Account Access Key.
- `access_mode` - (Required) The access mode to connect this storage to the Container App. Possible values include `ReadOnly` and `ReadWrite`. Changing this forces a new resource to be created.
- `account_name` - (Required) The Azure Storage Account in which the Share to be used is located. Changing this forces a new resource to be created.
- `share_name` - (Required) The name of the Azure Storage Share to use. Changing this forces a new resource to be created.

---
`timeouts` block supports the following:
- `create` - (Defaults to 30 minutes) Used when creating the Container App Environment Storage.
- `delete` - (Defaults to 30 minutes) Used when deleting the Container App Environment Storage.
- `read` - (Defaults to 5 minutes) Used when retrieving the Container App Environment Storage.
- `update` - (Defaults to 30 minutes) Used when updating the Container App Environment Storage.

Type:

```hcl
map(object({
access_key = string
access_mode = string
account_name = string
share_name = string
timeouts = optional(object({
create = optional(string)
delete = optional(string)
read = optional(string)
update = optional(string)
}))
}))
```

Default: `{}`

### <a name="input_tags"></a> [tags](#input\_tags)

Description: (Optional) A mapping of tags to assign to the resource.
Expand Down Expand Up @@ -312,6 +405,10 @@ Default: `true`

The following outputs are exported:

### <a name="output_dapr_components"></a> [dapr\_components](#output\_dapr\_components)

Description: A map of dapr components connected to this environment. The map key is the supplied input to var.storages. The map value is the azurerm-formatted version of the entire dapr\_components resource.

### <a name="output_id"></a> [id](#output\_id)

Description: The ID of the resource.
Expand All @@ -324,6 +421,10 @@ Description: The name of the resource

Description: The Container Apps Managed Environment resource.

### <a name="output_storages"></a> [storages](#output\_storages)

Description: A map of storage shares connected to this environment. The map key is the supplied input to var.storages. The map value is the azurerm-formatted version of the entire storage shares resource.

## Modules

No modules.
Expand Down
Empty file modified avm
100644 → 100755
Empty file.
117 changes: 117 additions & 0 deletions examples/dapr_component/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!-- BEGIN_TF_DOCS -->
# Default example

This deploys the module with a environment-scoped dapr component.

```hcl
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0, < 4.0.0"
}
}
}
provider "azurerm" {
skip_provider_registration = true
features {}
}
# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = "0.4.0"
}
# This is required for resource modules
resource "azurerm_resource_group" "this" {
name = module.naming.resource_group.name_unique
location = "australiaeast"
}
resource "azurerm_log_analytics_workspace" "this" {
name = module.naming.log_analytics_workspace.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
}
module "managedenvironment" {
source = "../../"
# source = "Azure/avm-res-app-managedenvironment/azurerm"
name = module.naming.container_app_environment.name_unique
resource_group_name = azurerm_resource_group.this.name
log_analytics_workspace_customer_id = azurerm_log_analytics_workspace.this.workspace_id
log_analytics_workspace_primary_shared_key = azurerm_log_analytics_workspace.this.primary_shared_key
dapr_components = {
"my-dapr-component" = {
component_type = "state.azure.blobstorage"
version = "v1"
}
}
# zone redundancy must be disabled unless we supply a subnet for vnet integration.
zone_redundancy_enabled = false
}
```

<!-- markdownlint-disable MD033 -->
## Requirements

The following requirements are needed by this module:

- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.3.0)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 3.7.0, < 4.0.0)

## Providers

The following providers are used by this module:

- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.7.0, < 4.0.0)

## Resources

The following resources are used by this module:

- [azurerm_log_analytics_workspace.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/log_analytics_workspace) (resource)
- [azurerm_resource_group.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) (resource)

<!-- markdownlint-disable MD013 -->
## Required Inputs

No required inputs.

## Optional Inputs

No optional inputs.

## Outputs

No outputs.

## Modules

The following Modules are called:

### <a name="module_managedenvironment"></a> [managedenvironment](#module\_managedenvironment)

Source: ../../

Version:

### <a name="module_naming"></a> [naming](#module\_naming)

Source: Azure/naming/azurerm

Version: 0.4.0

<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

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.
<!-- END_TF_DOCS -->
4 changes: 4 additions & 0 deletions examples/dapr_component/_footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

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.
3 changes: 3 additions & 0 deletions examples/dapr_component/_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default example

This deploys the module with a environment-scoped dapr component.
53 changes: 53 additions & 0 deletions examples/dapr_component/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0, < 4.0.0"
}
}
}

provider "azurerm" {
skip_provider_registration = true
features {}
}

# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = "0.4.0"
}

# This is required for resource modules
resource "azurerm_resource_group" "this" {
name = module.naming.resource_group.name_unique
location = "australiaeast"
}

resource "azurerm_log_analytics_workspace" "this" {
name = module.naming.log_analytics_workspace.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
}

module "managedenvironment" {
source = "../../"
# source = "Azure/avm-res-app-managedenvironment/azurerm"

name = module.naming.container_app_environment.name_unique
resource_group_name = azurerm_resource_group.this.name

log_analytics_workspace_customer_id = azurerm_log_analytics_workspace.this.workspace_id
log_analytics_workspace_primary_shared_key = azurerm_log_analytics_workspace.this.primary_shared_key

dapr_components = {
"my-dapr-component" = {
component_type = "state.azure.blobstorage"
version = "v1"
}
}

# zone redundancy must be disabled unless we supply a subnet for vnet integration.
zone_redundancy_enabled = false
}
Loading

0 comments on commit fbae279

Please sign in to comment.