Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import google_compute_router_nat fails #3538

Closed
ricosega opened this issue May 2, 2019 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#1852
Closed

import google_compute_router_nat fails #3538

ricosega opened this issue May 2, 2019 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#1852
Assignees
Labels

Comments

@ricosega
Copy link

ricosega commented May 2, 2019

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 v0.11.13

  • provider.google v2.5.1

Affected Resource(s)

google_compute_router_nat

Terraform Configuration Files

resource "google_compute_router_nat" "nat-gateway" {
  project   =   "project_name"
}

Debug Output

https://gist.github.com/ricosega/0b038513447d32312f563b152b52a0eb

Expected Behavior

Import the state in the state file

Actual Behavior

Prompting error and not saving it to state file.

Steps to Reproduce

  1. terraform import google_compute_router_nat.nat-gateway us-west2/core-router/nat-gateway
@ghost ghost added the bug label May 2, 2019
@rileykarson
Copy link
Collaborator

Hey @ricosega! terraform import doesn't actually pull information from the config; instead, the project is inferred from the default value defined in your provider block / by an env var.

@ricosega
Copy link
Author

ricosega commented May 3, 2019

I am not sure that is the problem, because I have been able to import any other resources but not this one.
And the error is the following where you can see that first it correctly imports the resource but then it fails when trying to refresh state:

google_compute_router_nat.nat-gateway: Importing from ID "us-west2/core-router/nat-gateway"...
google_compute_router_nat.nat-gateway: Import complete!
  Imported google_compute_router_nat (ID: us-west2/core-router/nat-gateway)
google_compute_router_nat.nat-gateway: Refreshing state... (ID: us-west2/core-router/nat-gateway)

Error: google_compute_router_nat.nat-gateway (import id: us-west2/core-router/nat-gateway): 1 error(s) occurred:

* import google_compute_router_nat.nat-gateway result: us-west2/core-router/nat-gateway: google_compute_router_nat.nat-gateway: project: required field is not set

@rileykarson rileykarson self-assigned this May 7, 2019
@JCMais
Copy link

JCMais commented May 28, 2019

I just had this problem. This particular import does not allow to pass the project via the id, like {project}/{region}/{router}/{nat}, while others (all the ones I imported so far) support that.

The fix like mentioned above by @rileykarson is to force some project, in my case I did:

GOOGLE_PROJECT=my-project-id terraform import google_compute_router_nat.nat-name region/router-name/nat-name

@rileykarson
Copy link
Collaborator

Project can be specified explicitly on the resource at import-time beginning with 2.8.0.

@ghost
Copy link

ghost commented Jul 1, 2019

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!

@ghost ghost locked and limited conversation to collaborators Jul 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants