diff --git a/modules/cloud-config-container/squid/README.md b/modules/cloud-config-container/squid/README.md index c2ed92aa5..be982fb99 100644 --- a/modules/cloud-config-container/squid/README.md +++ b/modules/cloud-config-container/squid/README.md @@ -25,10 +25,8 @@ This example will create a `cloud-config` that allows any client in the 10.0.0.0 ```hcl module "cos-squid" { source = "./modules/cos-container/squid" - config_variables = { - whitelist = [".github.com"] - clients = ["10.0.0.0/8"] - } + whitelist = [".github.com"] + clients = ["10.0.0.0/8"] } # use it as metadata in a compute instance or template @@ -45,10 +43,8 @@ This example shows how to create the single instance optionally managed by the m ```hcl module "cos-squid" { source = "./modules/cos-container/squid" - config_variables = { - whitelist = ["github.com"] - clients = ["10.0.0.0/8"] - } + whitelist = ["github.com"] + clients = ["10.0.0.0/8"] test_instance = { project_id = "my-project" zone = "europe-west1-b" @@ -65,13 +61,15 @@ module "cos-squid" { | name | description | type | required | default | |---|---|:---: |:---:|:---:| +| *clients* | List of CIDRs from which Squid will allow connections | list(string) | | [] | | *cloud_config* | Cloud config template path. If null default will be used. | string | | null | -| *config_variables* | Additional variables used to render the cloud-config template. This module requires at least whitelist and clients to be specified (as lists). | | | {} | -| *squid_config* | Squid configuration path, if null default will be used. | string | | null | +| *config_variables* | Additional variables used to render the cloud-config and Squid templates. | map(any) | | {} | | *file_defaults* | Default owner and permissions for files. | object({...}) | | ... | | *files* | Map of extra files to create on the instance, path as key. Owner and permissions will use defaults if null. | map(object({...})) | | {} | +| *squid_config* | Squid configuration path, if null default will be used. | string | | null | | *test_instance* | Test/development instance attributes, leave null to skip creation. | object({...}) | | null | -| *test_instance_defaults* | Test/development instance defaults used for optional configuration. | object({...}) | | ... | +| *test_instance_defaults* | Test/development instance defaults used for optional configuration. If image is null, COS stable will be used. | object({...}) | | ... | +| *whitelist* | List of domains Squid will allow connections to | list(string) | | [] | ## Outputs diff --git a/modules/cloud-config-container/squid/main.tf b/modules/cloud-config-container/squid/main.tf index f10e2c358..d2c7aca0c 100644 --- a/modules/cloud-config-container/squid/main.tf +++ b/modules/cloud-config-container/squid/main.tf @@ -39,7 +39,7 @@ locals { : var.cloud_config ) config_variables = merge(var.config_variables, { - whitelist = lookup(var.config_variables, "whitelist", []) - clients = lookup(var.config_variables, "clients", []) + whitelist = var.whitelist + clients = var.clients }) } diff --git a/modules/cloud-config-container/squid/variables.tf b/modules/cloud-config-container/squid/variables.tf index 18ef05636..cb8804016 100644 --- a/modules/cloud-config-container/squid/variables.tf +++ b/modules/cloud-config-container/squid/variables.tf @@ -22,8 +22,8 @@ variable "cloud_config" { variable "config_variables" { description = "Additional variables used to render the cloud-config and Squid templates." - # type = map(any) - default = {} + type = map(any) + default = {} } variable "squid_config" { @@ -53,3 +53,15 @@ variable "files" { })) default = {} } + +variable "whitelist" { + description = "List of domains Squid will allow connections to" + type = list(string) + default = [] +} + +variable "clients" { + description = "List of CIDRs from which Squid will allow connections" + type = list(string) + default = [] +}