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

Terraform crashes when importing a google_access_context_manager_service_perimeter resource #4045

Closed
rolandkool opened this issue Jul 17, 2019 · 4 comments
Assignees
Labels

Comments

@rolandkool
Copy link
Contributor

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 0.12.4
Google provider version 2.10.0

Affected Resource(s)

  • google_access_context_manager_service_perimeter

Terraform Configuration Files

resource "google_access_context_manager_service_perimeter" "sbs" {
  parent         = "accessPolicies/1234"
  name           = "accessPolicies/1234/servicePerimeters/sbs"
  title          = "sbs"
  perimeter_type = "PERIMETER_TYPE_REGULAR"
  status {
    restricted_services = [
      "bigquery.googleapis.com",
      "bigtable.googleapis.com",
      "dataflow.googleapis.com",
      "dataproc.googleapis.com",
      "cloudkms.googleapis.com",
      "logging.googleapis.com",
      "pubsub.googleapis.com",
      "spanner.googleapis.com",
      "storage.googleapis.com",
      "containerregistry.googleapis.com",
      "gkeconnect.googleapis.com",
      "gkehub.googleapis.com",
      "datacatalog.googleapis.com",
    ]
    access_levels = [
      "accessPolicies/1234/accessLevels/acl1",
      "accessPolicies/1234/accessLevels/acl2",
      "accessPolicies/1234/accessLevels/acl3",
      "accessPolicies/1234/accessLevels/acl4",
    ]
  }
  lifecycle {
    ignore_changes = [ "status[0].resources" ]
  }
}

Panic Output

See https://gist.github.com/rolandkool/37fb2d7f84c6207a024f76206a0d0d50

Expected Behavior

Import should succeed and statefile gets updated

Actual Behavior

Import command crashes

Steps to Reproduce

  1. create a perimeter via the gui
  2. use example tf file from above and match your config
  3. try running the import command: terraform import google_access_context_manager_service_perimeter.sbs sbs
@ghost ghost added the bug label Jul 17, 2019
@slevenick
Copy link
Collaborator

I believe the import command you want is
terraform import google_access_context_manager_service_perimeter.sbs accessPolicies/1234/servicePerimeters/sbs

Can you try that command and let me know if it works? Either way the import format should be documented better and not crash on an invalid input.

@slevenick
Copy link
Collaborator

slevenick commented Jul 17, 2019

I've added a regex on the import for that resource that will check that the name is in the expected form. This will be available in future releases of the terraform provider.

If changing the import command to the comment above does not fix the crash please reopen this issue

@rolandkool
Copy link
Contributor Author

@slevenick thanks for the quick response. Indeed, the import command was incorrect. When I use the format you provided it does not crash and works properly.

Indeed, the documentation about the import format is a bit vague so would be nice if it could be made somewhat more clear.

@ghost ghost removed the waiting-response label Jul 18, 2019
@ghost
Copy link

ghost commented Aug 17, 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 👉 [email protected]. Thanks!

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

No branches or pull requests

2 participants