Move client and whitelist to top level variables
This commit is contained in:
@@ -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 | <code title="list(string)">list(string)</code> | | <code title="">[]</code> |
|
||||
| *cloud_config* | Cloud config template path. If null default will be used. | <code title="">string</code> | | <code title="">null</code> |
|
||||
| *config_variables* | Additional variables used to render the cloud-config template. This module requires at least whitelist and clients to be specified (as lists). | | | <code title="">{}</code> |
|
||||
| *squid_config* | Squid configuration path, if null default will be used. | <code title="">string</code> | | <code title="">null</code> |
|
||||
| *config_variables* | Additional variables used to render the cloud-config and Squid templates. | <code title="map(any)">map(any)</code> | | <code title="">{}</code> |
|
||||
| *file_defaults* | Default owner and permissions for files. | <code title="object({ owner = string permissions = string })">object({...})</code> | | <code title="{ owner = "root" permissions = "0644" }">...</code> |
|
||||
| *files* | Map of extra files to create on the instance, path as key. Owner and permissions will use defaults if null. | <code title="map(object({ content = string owner = string permissions = string }))">map(object({...}))</code> | | <code title="">{}</code> |
|
||||
| *squid_config* | Squid configuration path, if null default will be used. | <code title="">string</code> | | <code title="">null</code> |
|
||||
| *test_instance* | Test/development instance attributes, leave null to skip creation. | <code title="object({ project_id = string zone = string name = string type = string network = string subnetwork = string })">object({...})</code> | | <code title="">null</code> |
|
||||
| *test_instance_defaults* | Test/development instance defaults used for optional configuration. | <code title="object({ disks = map(object({ read_only = bool size = number })) metadata = map(string) service_account_roles = list(string) tags = list(string) })">object({...})</code> | | <code title="{ disks = {} metadata = {} service_account_roles = [ "roles/logging.logWriter", "roles/monitoring.metricWriter" ] tags = ["ssh"] }">...</code> |
|
||||
| *test_instance_defaults* | Test/development instance defaults used for optional configuration. If image is null, COS stable will be used. | <code title="object({ disks = map(object({ read_only = bool size = number })) image = string metadata = map(string) nat = bool service_account_roles = list(string) tags = list(string) })">object({...})</code> | | <code title="{ disks = {} image = null metadata = {} nat = false service_account_roles = [ "roles/logging.logWriter", "roles/monitoring.metricWriter" ] tags = ["ssh"] }">...</code> |
|
||||
| *whitelist* | List of domains Squid will allow connections to | <code title="list(string)">list(string)</code> | | <code title="">[]</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 = []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user