Changed volume_mounts from list to map

This commit is contained in:
apichick 2021-11-01 19:12:39 +01:00
parent 35f51261bf
commit 2ae7965c5f
3 changed files with 6 additions and 9 deletions

View File

@ -136,11 +136,11 @@ module "cloud_run" {
| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| containers | Containers | <code title="list&#40;object&#40;&#123;&#10;image &#61; string&#10;command &#61; list&#40;string&#41;&#10;args &#61; list&#40;string&#41;&#10;env &#61; map&#40;string&#41;&#10;env_from &#61; map&#40;object&#40;&#123;&#10;key &#61; string&#10;name &#61; string&#10;&#125;&#41;&#41;&#10;resources &#61; object&#40;&#123;&#10;limits &#61; object&#40;&#123;&#10;cpu &#61; string&#10;memory &#61; string&#10;&#125;&#41;&#10;requests &#61; object&#40;&#123;&#10;cpu &#61; string&#10;memory &#61; string&#10;&#125;&#41;&#10;&#125;&#41;&#10;ports &#61; list&#40;object&#40;&#123;&#10;name &#61; string&#10;protocol &#61; string&#10;container_port &#61; string&#10;&#125;&#41;&#41;&#10;volume_mounts &#61; list&#40;object&#40;&#123;&#10;name &#61; string&#10;mount_path &#61; string&#10;&#125;&#41;&#41;&#10;&#125;&#41;&#41;">list(object({...}))</code> | ✓ | |
| containers | Containers | <code title="list&#40;object&#40;&#123;&#10;image &#61; string&#10;command &#61; list&#40;string&#41;&#10;args &#61; list&#40;string&#41;&#10;env &#61; map&#40;string&#41;&#10;env_from &#61; map&#40;object&#40;&#123;&#10;key &#61; string&#10;name &#61; string&#10;&#125;&#41;&#41;&#10;resources &#61; object&#40;&#123;&#10;limits &#61; object&#40;&#123;&#10;cpu &#61; string&#10;memory &#61; string&#10;&#125;&#41;&#10;requests &#61; object&#40;&#123;&#10;cpu &#61; string&#10;memory &#61; string&#10;&#125;&#41;&#10;&#125;&#41;&#10;ports &#61; list&#40;object&#40;&#123;&#10;name &#61; string&#10;protocol &#61; string&#10;container_port &#61; string&#10;&#125;&#41;&#41;&#10;volume_mounts &#61; map&#40;string&#41;&#10;&#125;&#41;&#41;">list(object({...}))</code> | ✓ | |
| name | Name used for cloud run service | <code title="">string</code> | ✓ | |
| project_id | Project id used for all resources. | <code title="">string</code> | ✓ | |
| *audit_log_triggers* | Event arc triggers (Audit log) | <code title="list&#40;object&#40;&#123;&#10;service_name &#61; string&#10;method_name &#61; string&#10;&#125;&#41;&#41;">list(object({...}))</code> | | <code title="">null</code> |
| *iam* | IAM bindings for topic in {ROLE => [MEMBERS]} format. | <code title="map&#40;list&#40;string&#41;&#41;">map(list(string))</code> | | <code title="">{}</code> |
| *iam* | IAM bindings for Cloud Run service in {ROLE => [MEMBERS]} format. | <code title="map&#40;list&#40;string&#41;&#41;">map(list(string))</code> | | <code title="">{}</code> |
| *ingress_settings* | Ingress settings | <code title="">string</code> | | <code title="">null</code> |
| *labels* | Resource labels | <code title="map&#40;string&#41;">map(string)</code> | | <code title="">{}</code> |
| *prefix* | Optional prefix used for resource names. | <code title="">string</code> | | <code title="">null</code> |

View File

@ -96,10 +96,10 @@ resource "google_cloud_run_service" "service" {
}
}
dynamic "volume_mounts" {
for_each = containers.value["volume_mounts"] == null ? [] : containers.value["volume_mounts"]
for_each = containers.value["volume_mounts"] == null ? {} : containers.value["volume_mounts"]
content {
name = volume_mounts.value["name"]
mount_path = volume_mounts.value["mount_path"]
name = volume_mounts.key
mount_path = volume_mounts.value
}
}
}

View File

@ -50,10 +50,7 @@ variable "containers" {
protocol = string
container_port = string
}))
volume_mounts = list(object({
name = string
mount_path = string
}))
volume_mounts = map(string)
}))
}