Skip to content

Commit

Permalink
Linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Aug 2, 2024
1 parent 1b7fbd7 commit 0bae03c
Show file tree
Hide file tree
Showing 38 changed files with 230 additions and 125 deletions.
50 changes: 18 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ The following requirements are needed by this module:

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

- <a name="requirement_azapi"></a> [azapi](#requirement\_azapi) (~> 1.14)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (~> 3.113)

- <a name="requirement_modtm"></a> [modtm](#requirement\_modtm) (~> 0.3)

- <a name="requirement_random"></a> [random](#requirement\_random) (~> 3.5)

- <a name="requirement_time"></a> [time](#requirement\_time) (~> 0.12)

## Resources

The following resources are used by this module:

- [azurerm_container_app_environment.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/container_app_environment) (resource)
- [azurerm_management_lock.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_lock) (resource)
- [azurerm_nat_gateway.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/nat_gateway) (resource)
- [azurerm_nat_gateway_public_ip_association.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/nat_gateway_public_ip_association) (resource)
- [azurerm_private_dns_zone.container_registry](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_zone) (resource)
Expand All @@ -47,6 +48,12 @@ The following resources are used by this module:

The following input variables are required:

### <a name="input_location"></a> [location](#input\_location)

Description: Azure region where the resource should be deployed.

Type: `string`

### <a name="input_postfix"></a> [postfix](#input\_postfix)

Description: A postfix used to build default names if no name has been supplied for a specific resource type.
Expand Down Expand Up @@ -519,14 +526,6 @@ Type: `bool`

Default: `true`

### <a name="input_custom_container_image_name"></a> [custom\_container\_image\_name](#input\_custom\_container\_image\_name)

Description: The image to use in the container registry to use if `create_container_registry` is `false`.

Type: `string`

Default: `null`

### <a name="input_custom_container_registry_images"></a> [custom\_container\_registry\_images](#input\_custom\_container\_registry\_images)

Description: The images to build and push to the container registry. This is only relevant if `create_container_registry` is `true` and `use_default_container_image` is set to `false`.
Expand Down Expand Up @@ -634,28 +633,23 @@ Type: `bool`

Default: `true`

### <a name="input_location"></a> [location](#input\_location)

Description: Azure region where the resource should be deployed. Must be specified if `resource_group_creation_enabled == true`.

Type: `string`

Default: `null`

### <a name="input_lock"></a> [lock](#input\_lock)

Description: The lock level to apply. Default is `None`. Possible values are `None`, `CanNotDelete`, and `ReadOnly`.
Description: Controls the Resource Lock configuration for this resource. The following properties can be specified:

- `kind` - (Required) The type of lock. Possible values are `\"CanNotDelete\"` and `\"ReadOnly\"`.
- `name` - (Optional) The name of the lock. If not specified, a name will be generated based on the `kind` value. Changing this forces the creation of a new resource.

Type:

```hcl
object({
kind = string
name = optional(string, null)
kind = optional(string, "None")
})
```

Default: `{}`
Default: `null`

### <a name="input_log_analytics_workspace_id"></a> [log\_analytics\_workspace\_id](#input\_log\_analytics\_workspace\_id)

Expand Down Expand Up @@ -739,11 +733,11 @@ Default: `null`

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

Description: The map of tags to be applied to the resource
Description: (Optional) Tags of the resource.

Type: `map(any)`
Type: `map(string)`

Default: `{}`
Default: `null`

### <a name="input_use_default_container_image"></a> [use\_default\_container\_image](#input\_use\_default\_container\_image)

Expand Down Expand Up @@ -857,14 +851,6 @@ Type: `string`

Default: `null`

### <a name="input_virtual_network_resource_group_name"></a> [virtual\_network\_resource\_group\_name](#input\_virtual\_network\_resource\_group\_name)

Description: The name of the Virtual Network's Resource Group. Must be specified if `virtual_network_creation_enabled` == `false`

Type: `string`

Default: `""`

## Outputs

The following outputs are exported:
Expand Down
1 change: 1 addition & 0 deletions examples/azure_devops_container_instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}
output "container_instance_resource_Ids" {
Expand Down
3 changes: 2 additions & 1 deletion examples/azure_devops_container_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}

output "container_instance_resource_Ids" {
output "container_instance_resource_ids" {
value = module.azure_devops_agents.container_instance_resource_ids
}

Expand Down
1 change: 1 addition & 0 deletions examples/azure_devops_public_networking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
use_private_networking = false
tags = local.tags
}
output "container_app_environment_resource_id" {
Expand Down
1 change: 1 addition & 0 deletions examples/azure_devops_public_networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
use_private_networking = false
tags = local.tags
}

output "container_app_environment_resource_id" {
Expand Down
1 change: 1 addition & 0 deletions examples/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}
output "container_app_environment_resource_id" {
Expand Down
1 change: 1 addition & 0 deletions examples/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ module "azure_devops_agents" {
version_control_system_organization = local.azure_devops_organization_url
version_control_system_pool_name = azuredevops_agent_pool.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}

output "container_app_environment_resource_id" {
Expand Down
1 change: 1 addition & 0 deletions examples/github_basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}
# Region helpers
Expand Down
2 changes: 1 addition & 1 deletion examples/github_basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ data "github_organization" "alz" {
locals {
action_file = "action.yml"
default_commit_email = "[email protected]"
enterprise_plan = "enterprise"
free_plan = "free"
}

Expand Down Expand Up @@ -102,6 +101,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}

# Region helpers
Expand Down
1 change: 1 addition & 0 deletions examples/github_container_instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}
# Region helpers
Expand Down
2 changes: 1 addition & 1 deletion examples/github_container_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ data "github_organization" "alz" {
locals {
action_file = "action.yml"
default_commit_email = "[email protected]"
enterprise_plan = "enterprise"
free_plan = "free"
}

Expand Down Expand Up @@ -103,6 +102,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
virtual_network_address_space = "10.0.0.0/16"
tags = local.tags
}

# Region helpers
Expand Down
1 change: 1 addition & 0 deletions examples/github_public_networking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
use_private_networking = false
tags = local.tags
}
# Region helpers
Expand Down
2 changes: 1 addition & 1 deletion examples/github_public_networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ data "github_organization" "alz" {
locals {
action_file = "action.yml"
default_commit_email = "[email protected]"
enterprise_plan = "enterprise"
free_plan = "free"
}

Expand Down Expand Up @@ -102,6 +101,7 @@ module "github_runners" {
version_control_system_organization = var.github_organization_name
version_control_system_repository = github_repository.this.name
use_private_networking = false
tags = local.tags
}

# Region helpers
Expand Down
11 changes: 7 additions & 4 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ locals {
resource_group_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${local.resource_group_name}"
resource_group_name = var.resource_group_creation_enabled ? azurerm_resource_group.this[0].name : var.resource_group_name
resource_group_name_container_app_infrastructure = var.container_app_infrastructure_resource_group_name == null ? "rg-${var.postfix}-container-apps-infrastructure" : var.container_app_infrastructure_resource_group_name
role_definition_resource_substring = "/providers/Microsoft.Authorization/roleDefinitions"
user_assigned_managed_identity_principal_id = var.create_user_assigned_managed_identity ? module.user_assigned_managed_identity[0].principal_id : var.user_assigned_managed_identity_principal_id
}

Expand Down Expand Up @@ -53,12 +52,16 @@ locals {
image_names = ["${local.default_image_name}:${var.default_image_repository_commit}"]
}
} : {}
default_image_name = var.default_image_name != null ? var.default_image_name : (var.version_control_system_type == local.version_control_system_azure_devops ? "azure-devops-agent" : "github-runner")
version_control_system_azure_devops = "azuredevops"
version_control_system_github = "github"
default_image_name = var.default_image_name != null ? var.default_image_name : (var.version_control_system_type == local.version_control_system_azure_devops ? "azure-devops-agent" : "github-runner")
}

locals {
deploy_container_app = contains(var.compute_types, "azure_container_app")
deploy_container_instance = contains(var.compute_types, "azure_container_instance")
valid_version_control_systems = [
local.version_control_system_azure_devops,
local.version_control_system_github
]
version_control_system_azure_devops = "azuredevops"
version_control_system_github = "github"
}
4 changes: 2 additions & 2 deletions main.container.app.job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ resource "time_offset" "placeholder_job" {
depends_on = [module.container_registry, azurerm_container_app_environment.this]
}



module "container_app_job" {
count = local.deploy_container_app ? 1 : 0
source = "./modules/container-app-job"
Expand All @@ -33,6 +31,8 @@ module "container_app_job" {
container_app_environment_id = local.container_app_environment_id

registry_login_server = local.registry_login_server
registry_username = var.custom_container_registry_username
registry_password = var.custom_container_registry_password
container_image_name = local.container_images["container_app"].image_names[0]

job_name = var.container_app_job_name
Expand Down
3 changes: 3 additions & 0 deletions main.container.instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ module "container_instance" {
availability_zones = each.value.availability_zones
user_assigned_managed_identity_id = local.user_assigned_managed_identity_id
container_registry_login_server = local.registry_login_server
container_registry_username = var.custom_container_registry_username
container_registry_password = var.custom_container_registry_password
}

10 changes: 10 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@ resource "azurerm_resource_group" "this" {

location = var.location
name = var.resource_group_name == null ? "rg-${var.postfix}" : var.resource_group_name
tags = var.tags
}

resource "azurerm_management_lock" "this" {
count = var.lock != null ? 1 : 0

lock_level = var.lock.kind
name = coalesce(var.lock.name, "lock-${var.lock.kind}")
scope = azurerm_resource_group.this.id
notes = var.lock.kind == "CanNotDelete" ? "Cannot delete the resource or its child resources." : "Cannot delete or modify the resource or its child resources."
}
4 changes: 4 additions & 0 deletions main.virtual.network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "azurerm_private_dns_zone" "container_registry" {

name = "privatelink.azurecr.io"
resource_group_name = local.resource_group_name
tags = var.tags
}

resource "azurerm_private_dns_zone_virtual_network_link" "container_registry" {
Expand All @@ -68,6 +69,7 @@ resource "azurerm_private_dns_zone_virtual_network_link" "container_registry" {
private_dns_zone_name = azurerm_private_dns_zone.container_registry[0].name
resource_group_name = local.resource_group_name
virtual_network_id = module.virtual_network[0].resource_id
tags = var.tags
}

resource "azurerm_public_ip" "this" {
Expand All @@ -78,6 +80,7 @@ resource "azurerm_public_ip" "this" {
name = local.public_ip_name
resource_group_name = local.resource_group_name
sku = "Standard"
tags = var.tags
}

resource "azurerm_nat_gateway" "this" {
Expand All @@ -87,6 +90,7 @@ resource "azurerm_nat_gateway" "this" {
name = local.nat_gateway_name
resource_group_name = local.resource_group_name
sku_name = "Standard"
tags = var.tags
}

resource "azurerm_nat_gateway_public_ip_association" "this" {
Expand Down
Loading

0 comments on commit 0bae03c

Please sign in to comment.