Skip to content

Commit

Permalink
feat: pass environment variables to cloud task via provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Fechner committed Mar 25, 2024
1 parent 4c44fe8 commit 29c3da9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_additional_environment_variables"></a> [additional\_environment\_variables](#input\_additional\_environment\_variables) | Optional list of additional environment variables passed to the task. | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| <a name="input_blob_container_name"></a> [blob\_container\_name](#input\_blob\_container\_name) | name of the blob container used for storing analysis artifacts. Leave blank to generate one | `string` | `""` | no |
| <a name="input_create_log_analytics_workspace"></a> [create\_log\_analytics\_workspace](#input\_create\_log\_analytics\_workspace) | Creates a log analytics workspace to see container logs. Defaults to false to avoid charging | `bool` | `false` | no |
| <a name="input_custom_network"></a> [custom\_network](#input\_custom\_network) | The name of the custom Azure Virtual Network subnet. Make sure it allows egress traffic on port 443. Leave empty to create a new one. | `string` | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions examples/tenant-single-region/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ module "lacework_azure_agentless_scanning_single_tenant" {
create_log_analytics_workspace = true
integration_level = "tenant"
tags = { "lw-example-tf" : "true" }
additional_environment_variables = [{name="EXAMPLE_ENV_VAR", value="some_value"}]
}
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ locals {
AZURE_KEY_VAULT_SECRET_NAME = local.key_vault_secret_name
AZURE_KEY_VAULT_URI = local.key_vault_uri
}
environment_variables_as_list = [for key, val in local.environment_variables : { name = key, value = val }]
environment_variables_as_list = concat([for key, val in local.environment_variables : { name = key, value = val }],
[for obj in var.additional_environment_variables : { name = obj["name"], value = obj["value"] }])

key_vault_id = var.global ? azurerm_key_vault.lw_orchestrate[0].id : (
length(var.global_module_reference.key_vault_id) > 0 ? var.global_module_reference.key_vault_id : var.key_vault_id
Expand Down
2 changes: 1 addition & 1 deletion output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ output "sidekick_principal_id" {
output "subscriptions_list" {
value = local.subscriptions_list_local
description = "The subscriptions list in global module reference"
}
}
11 changes: 10 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,13 @@ variable "global_module_reference" {
subscriptions_list = []
}
description = "A reference to the global lacework_azure_agentless_scanning module for this account."
}
}

variable "additional_environment_variables" {
type = list(object({
name = string
value = string
}))
default = []
description = "Optional list of additional environment variables passed to the task."
}

0 comments on commit 29c3da9

Please sign in to comment.