hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

google_compute_router_peer import not populate the advertise_mode #6259

Closed sebglon closed 4 years ago

sebglon commented 4 years ago

Community Note

Terraform Version

$ terraform versionTerraform v0.12.23

Affected Resource(s)

Terraform Configuration Files

resource "google_compute_router_peer" "gcp-router2-peer" {
  count   = length(var.vpns)
  project = google_project.main_project.project_id
  region  = var.vpns[count.index]["region"]

  name            = "gcp-to-aws-bgp2-x"
  router          = "gcp-router2-x"
  peer_ip_address = "1.1.1.1"
  peer_asn        = "7224"
  interface       = "gcp-to-aws-interface2-x"
  advertise_mode  = "DEFAULT"
}

Debug Output

Expected Behavior

The import populate the advertise_mode

Actual Behavior

The import not populate the advertise_mode field as DEFAULT and the next plan want to re-create the resource to set the

Steps to Reproduce

  1. terraform import module.project.google_compute_router_peer.gcp-router2-peer[0] my-project/europe-west3/gcp-router2-europe-west3/gcp-to-aws-bgp2- europe-west3
    
    module.project.google_compute_router_peer.gcp-router2-peer[0]: Importing from ID "my-project/europe-west3/gcp-router2-europe-west3/gcp-to-aws-bgp2-europe-we
    st3"...
    module.project.google_compute_router_peer.gcp-router2-peer[0]: Import prepared!
    Prepared google_compute_router_peer for import
    module.project.google_compute_router_peer.gcp-router2-peer[0]: Refreshing state... [id=projects/my-project/regions/europe-west3/routers/gcp-router2-europe-w
    est3/gcp-to-aws-bgp2-europe-west3]

Import successful!

The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform.


2. `terraform plan -target=module.project.google_compute_router_peer.gcp-router2-peer[0]` 

module.project.google_compute_router_peer.gcp-router2-peer[0] must be replaced

-/+ resource "google_compute_router_peer" "gcp-router2-peer" {

Plan: 1 to add, 0 to change, 1 to destroy.

sebglon commented 4 years ago

It seem fixed on the 2.17 but not reported on 3.x https://github.com/terraform-providers/terraform-provider-google/pull/4503

sebglon commented 4 years ago

Fix is available here : https://github.com/GoogleCloudPlatform/magic-modules/pull/3454

venkykuberan commented 4 years ago

Thanks for the PR, this issue will be closed after the PR approved/merged

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!