Implemented conditional dynamic blocks for `google_access_context_manager_service_perimeter` `spec` and `status` (#1177)
* implemented conditional dynamic blocks * Fix linting * avoid setting spec in bridge perimeters if no resources are set --------- Co-authored-by: Julio Castillo <jccb@google.com> Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
parent
463dc41ede
commit
aecb6fd543
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2022 Google LLC
|
* Copyright 2023 Google LLC
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -27,15 +27,22 @@ resource "google_access_context_manager_service_perimeter" "bridge" {
|
||||||
title = each.key
|
title = each.key
|
||||||
perimeter_type = "PERIMETER_TYPE_BRIDGE"
|
perimeter_type = "PERIMETER_TYPE_BRIDGE"
|
||||||
use_explicit_dry_run_spec = each.value.use_explicit_dry_run_spec
|
use_explicit_dry_run_spec = each.value.use_explicit_dry_run_spec
|
||||||
spec {
|
|
||||||
resources = each.value.spec_resources == null ? [] : each.value.spec_resources
|
dynamic "spec" {
|
||||||
|
for_each = each.value.spec_resources == null ? [] : [""]
|
||||||
|
content {
|
||||||
|
resources = each.value.spec_resources
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status {
|
status {
|
||||||
resources = each.value.status_resources == null ? [] : each.value.status_resources
|
resources = each.value.status_resources == null ? [] : each.value.status_resources
|
||||||
}
|
}
|
||||||
|
|
||||||
# lifecycle {
|
# lifecycle {
|
||||||
# ignore_changes = [spec[0].resources, status[0].resources]
|
# ignore_changes = [spec[0].resources, status[0].resources]
|
||||||
# }
|
# }
|
||||||
|
|
||||||
depends_on = [
|
depends_on = [
|
||||||
google_access_context_manager_access_policy.default,
|
google_access_context_manager_access_policy.default,
|
||||||
google_access_context_manager_access_level.basic,
|
google_access_context_manager_access_level.basic,
|
||||||
|
|
Loading…
Reference in New Issue