Enable terraform_naming_convention in tflint (#3930)

* Draft terraform_naming_convention

* Two fast/stages fixes for terraform_naming_convention

* Disable terraform_naming_convention for resources for now

* module fixes for terraform_naming_convention

* tfdoc

* Remove "moved" from recipe and needs-fixing

* Fix moved for spoke_ra

* fix tests

* Use default (snake_case) for resources

* factory.terraform_data.project-preconditions

* First-pass migration of resources + tests

* Fix tests/modules/organization

* Require snake_case for variables; Add annotations for _testing

* permit _fast_debug variable

* Fix net_vpc_factory and net_vpc_firewall tests

* tfdoc addons and recipe

* Fix more tests

* Fix some net-global -> net_global tests

---------

Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
Simon Roberts
2026-05-06 16:06:26 +10:00
committed by GitHub
parent ba56d9afbc
commit 26dbaa2d6e
83 changed files with 570 additions and 284 deletions

View File

@@ -272,19 +272,19 @@ Security profiles group defined here are exported via output variable file, and
| name | description | type | required | default | producer |
|---|---|:---:|:---:|:---:|:---:|
| [automation](variables-fast.tf#L28) | Automation resources created by the bootstrap stage. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-bootstrap</code> |
| [automation](variables-fast.tf#L29) | Automation resources created by the bootstrap stage. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-bootstrap</code> |
| [ngfw_config](variables.tf#L113) | Configuration for NGFW Enterprise endpoints. Billing project defaults to the automation project. Network and TLS inspection policy ids support interpolation. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | |
| [organization](variables-fast.tf#L56) | Organization details. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-globals</code> |
| [organization](variables-fast.tf#L57) | Organization details. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-globals</code> |
| [project_id](variables.tf#L134) | Project where the network security resources will be created. | <code>string</code> | ✓ | | |
| [_fast_debug](variables-fast.tf#L19) | Internal FAST variable used for testing and debugging. Do not use. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [_fast_debug](variables-fast.tf#L20) | Internal FAST variable used for testing and debugging. Do not use. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [certificate_authorities](variables.tf#L17) | Certificate Authority Service pool and CAs. If host project ids is null identical pools and CAs are created in every host project. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
| [certificate_authority_pools](variables-fast.tf#L36) | Certificate authority pools. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | <code>2-security</code> |
| [certificate_authority_pools](variables-fast.tf#L37) | Certificate authority pools. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | <code>2-security</code> |
| [enable_services](variables.tf#L97) | Configure project by enabling services required for this add-on. | <code>bool</code> | | <code>true</code> | |
| [host_project_ids](variables-fast.tf#L48) | Networking stage host project id aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [host_project_ids](variables-fast.tf#L49) | Networking stage host project id aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [names](variables.tf#L104) | Configuration for names used for output files. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [outputs_location](variables.tf#L128) | Path where providers and tfvars files for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
| [security_profiles](variables.tf#L140) | Security profile groups for Layer 7 inspection. Null environment list means all environments. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#8230;&#125;</code> | |
| [tls_inspection_policies](variables.tf#L223) | TLS inspection policies configuration. CA pools, trust configs and host project ids support interpolation. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
| [trust_configs](variables.tf#L265) | Certificate Manager trust configurations for TLS inspection policies. Project ids and region can reference keys in the relevant FAST variables. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#8230;&#125;</code> | |
| [vpc_self_links](variables-fast.tf#L66) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [vpc_self_links](variables-fast.tf#L67) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
<!-- END TFDOC -->

View File

@@ -16,6 +16,7 @@
# tfdoc:file:description FAST stage interface.
# tflint-ignore: terraform_naming_convention
variable "_fast_debug" {
description = "Internal FAST variable used for testing and debugging. Do not use."
type = object({

View File

@@ -151,22 +151,22 @@ terraform apply
| name | description | type | required | default | producer |
|---|---|:---:|:---:|:---:|:---:|
| [automation](variables-fast.tf#L28) | Automation resources created by the bootstrap stage. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-bootstrap</code> |
| [automation](variables-fast.tf#L29) | Automation resources created by the bootstrap stage. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | <code>0-bootstrap</code> |
| [certificate_authority](variables.tf#L17) | Optional Certificate Authority Service pool and CA used by SWP. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | ✓ | | |
| [project_id](variables.tf#L143) | Project where the resources will be created. | <code>string</code> | ✓ | | |
| [_fast_debug](variables-fast.tf#L19) | Internal FAST variable used for testing and debugging. Do not use. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [_fast_debug](variables-fast.tf#L20) | Internal FAST variable used for testing and debugging. Do not use. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [enable_services](variables.tf#L95) | Configure project by enabling services required for this add-on. | <code>bool</code> | | <code>false</code> | |
| [factories_config](variables.tf#L102) | SWP factories configuration paths. Keys in the `swp_configs` variable will be appended to derive individual SWP factory paths. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [host_project_ids](variables-fast.tf#L36) | Networking stage host project id aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [host_project_ids](variables-fast.tf#L37) | Networking stage host project id aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [locations](variables.tf#L112) | Regions where the resources will be created. Keys are used as short names appended to resource names. Interpolation with FAST region names is supported. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | |
| [name](variables.tf#L119) | Name used for resource names. | <code>string</code> | | <code>&#34;swp&#34;</code> | |
| [outputs_location](variables.tf#L126) | Path where providers and tfvars files for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
| [policy_rules_contexts](variables.tf#L132) | Replacement contexts for policy rules matcher arguments. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
| [regions](variables-fast.tf#L44) | Networking stage region aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [subnet_self_links](variables-fast.tf#L52) | VPC subnetwork self links. | <code>map&#40;map&#40;string&#41;&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [regions](variables-fast.tf#L45) | Networking stage region aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [subnet_self_links](variables-fast.tf#L53) | VPC subnetwork self links. | <code>map&#40;map&#40;string&#41;&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [swp_configs](variables.tf#L149) | Secure Web Proxy configuration, one per region. | <code>map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
| [tls_inspection_policy](variables.tf#L179) | TLS inspection policy configuration. If a CA pool is not specified a local one must be created via the `certificate_authority` variable. | <code>object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> | |
| [vpc_self_links](variables-fast.tf#L60) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
| [vpc_self_links](variables-fast.tf#L61) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
## Outputs

View File

@@ -16,6 +16,7 @@
# tfdoc:file:description FAST stage interface.
# tflint-ignore: terraform_naming_convention
variable "_fast_debug" {
description = "Internal FAST variable used for testing and debugging. Do not use."
type = object({

View File

@@ -14,7 +14,12 @@
* limitations under the License.
*/
resource "terraform_data" "precondition-cicd" {
moved {
from = terraform_data.precondition-cicd
to = terraform_data.precondition_cicd
}
resource "terraform_data" "precondition_cicd" {
lifecycle {
precondition {
condition = alltrue([

View File

@@ -35,7 +35,12 @@ locals {
}
}
module "firewall_policies" {
moved {
from = module.firewall_policies
to = module.firewall-policies
}
module "firewall-policies" {
source = "../../../modules/net-firewall-policy"
for_each = local.firewall_policies
attachments = each.value.attachments