Skip to content

cloud router import fails for bgp.0.asn == 0 #15191

Description

@samveen

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.5.3
on linux_arm64
+ provider registry.terraform.io/hashicorp/google v4.73.1

Affected Resource(s)

  • google_compute_router

Terraform Configuration Files

resource "google_compute_router" "myvpc-router" {
  bgp {
    advertise_mode = "CUSTOM"
    advertised_ip_ranges {
      range = "10.161.0.0/16"
    }
    asn                = "0"
    keepalive_interval = "20"
  }

  encrypted_interconnect_router = "false"
  name                          = "myvpc-router"
  network                       = data.terraform_remote_state.common.outputs.network_myvpc_link
  project                       = var.project
  region                        = var.region
}

Output

╷
│ Error: expected "bgp.0.asn" to be a RFC6996-compliant Local ASN:
│ must be either in the private ASN ranges: [64512..65534], [4200000000..4294967294];
│ or be the value of [16550], got 0
│ 
│   with module.routers.google_compute_router.myvpc-router,
│   on google/routers/compute_router.tf line 9, in resource "google_compute_router" "myvpc-router":
│    9:     asn                = "0"
│ 
╵

Expected Behavior

  • tf plan should accept the router definition in the tf code, because the router exists, exactly as described by the TF code:

    samveen@zero2w:~ $ gcloud compute routers describe myvpc-router
    bgp:
      advertiseMode: CUSTOM
      advertisedIpRanges:
      - description: ''
        range: 10.161.0.0/16
      asn: 0
      keepaliveInterval: 20
    creationTimestamp: '2022-01-20T06:18:09.403-08:00'
    description: ''
    encryptedInterconnectRouter: false
    id: '2137032174711656910'
    kind: compute#router
    name:myvpc-router
    nats:
    - enableEndpointIndependentMapping: false
      endpointTypes:
      - ENDPOINT_TYPE_VM
      icmpIdleTimeoutSec: 30
      logConfig:
        enable: false
        filter: ALL
      minPortsPerVm: 64
      name: myvpc
      natIpAllocateOption: MANUAL_ONLY
      natIps:
      - https://www.googleapis.com/compute/v1/projects/gr-eat-69/regions/asia-south1/addresses/myvpc-nat-1
      sourceSubnetworkIpRangesToNat: LIST_OF_SUBNETWORKS
      subnetworks:
      - name: https://www.googleapis.com/compute/v1/projects/gr-eat-69/regions/asia-south1/subnetworks/myvpc-priv-1
        sourceIpRangesToNat:
        - PRIMARY_IP_RANGE
      tcpEstablishedIdleTimeoutSec: 1200
      tcpTransitoryIdleTimeoutSec: 30
      udpIdleTimeoutSec: 30
    network: https://www.googleapis.com/compute/v1/projects/gr-eat-69/global/networks/myvpc
    region: https://www.googleapis.com/compute/v1/projects/gr-eat-69/regions/asia-south1
    selfLink: https://www.googleapis.com/compute/v1/projects/gr-eat-69/regions/asia-south1/routers/myvpc-router
    

Actual Behavior

Terraform throws an error.

Steps to Reproduce

  1. Router as described in terraform
  2. terraform plan to check against actual definition before terraform import

Important Factoids

  • I am using my google account for the actions instead of a service account.

References

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions