Project: Chef InSpec (Provisioning / Security & Compliance)
File: google_compute_router_nat.md

+++ title = "googlecomputerouter_nat resource" draft = false gh_repo = "inspec" platform = "gcp" [menu] [menu.inspec] title = "googlecomputerouter_nat" identifier = "inspec/resources/gcp/googlecomputerouternat.md googlecomputerouternat resource" parent = "inspec/resources/gcp" +++ A `googlecomputerouter_nat` is used to test a Google RouterNat resource This resource has beta fields available. To retrieve these fields, include `beta: true` in the constructor for the resource ```ruby describe googlecomputerouter_nat(project: 'chef-gcp-inspec', region: 'europe-west2', router: 'inspec-gcp-router', name: 'inspec-router-nat') do it { should exist } its('natipallocateoption') { should cmp 'AUTOONLY' } its('sourcesubnetworkiprangestonat') { should cmp 'ALLSUBNETWORKSALLIP_RANGES' } its('minportsper_vm') { should cmp '2' } its('log_config.enable') { should cmp 'true' } its('logconfig.filter') { should cmp 'ERRORSONLY' } end describe googlecomputerouter(project: 'chef-gcp-inspec', region: 'europe-west2', router: 'nonexistent', name: 'nonexistent') do it { should_not exist } end ``` Properties that can be accessed from the `googlecomputerouter_nat` resource: `name` : Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035. `natipallocate_option` : How external IPs should be allocated for this NAT. Valid values are `AUTOONLY` for only allowing NAT IPs allocated by Google Cloud Platform, or `MANUALONLY` for only user-allocated NAT IP addresses. Possible values: MANUAL_ONLY AUTO_ONLY `nat_ips` : Self-links of NAT IPs. Only valid if natIpAllocateOption is set to MANUAL_ONLY. `drainnatips` : A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. `sourcesubnetworkiprangesto_nat` : How NAT should be configured per Subnetwork. If `ALLSUBNETWORKSALLIPRANGES`, all of the IP ranges in every Subnetwork are allowed to Nat. If `ALLSUBNETWORKSALLPRIMARYIPRANGES`, all of the primary IP ranges in every Subnetwork are allowed to Nat. `LISTOFSUBNETWORKS`: A list of Subnetworks are allowed to Nat (specified in the field subnetwork below). Note that if this field contains ALLSUBNETWORKSALLIPRANGES or ALLSUBNETWORKSALLPRIMARYIPRANGES, then there should not be any other RouterNat section in any Router for this network in this region. Possible values: ALLSUBNETWORKSALLIPRANGES ALLSUBNETWORKSALLPRIMARYIP_RANGES LISTOFSUBNETWORKS `subnetwork` : One or more subnetwork NAT configurations. Only used if `sourcesubnetworkiprangestonat` is set to `LISTOF_SUBNETWORKS` `name` : Self-link of subnetwork to NAT `sourceiprangestonat` : List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: `ALLIPRANGES` `LISTOFSECONDARYIPRANGES` `PRIMARYIPRANGE` `secondaryiprange_names` : List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if `LISTOFSECONDARYIPRANGES` is one of the values in sourceIpRangesToNat `minportsper_vm` : Minimum number of ports allocated to a VM from this NAT. `udpidletimeout_sec` : Timeout (in seconds) for UDP connections. Defaults to 30s if not set. `icmpidletimeout_sec` : Timeout (in seconds) for ICMP connections. Defaults to 30s if not set. `tcpestablishedidletimeoutsec` : Timeout (in seconds) for TCP established connections. Defaults to 1200s if not set. `tcptransitoryidletimeoutsec` : Timeout (in seconds) for TCP transitory connections. Defaults to 30s if not set. `log_config` : Configuration for logging on NAT `enable` : Indicates whether or not to export logs. `filter` : Specifies the desired filtering of logs on this NAT. Possible values: ERRORS_ONLY TRANSLATIONS_ONLY ALL `router` : The name of the Cloud Router in which this NAT will be configured. `region` : Region where the router and NAT reside. Ensure the is enabled for the current project.