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 fails for google_access_context_manager_access_policy #7360

Closed
65156 opened this issue Sep 25, 2020 · 8 comments
Closed

import fails for google_access_context_manager_access_policy #7360

65156 opened this issue Sep 25, 2020 · 8 comments
Assignees
Labels

Comments

@65156
Copy link

65156 commented Sep 25, 2020

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

Your version of Terraform is out of date! The latest version
is 0.13.3. You can update by downloading from https://www.terraform.io/downloads.html
Terraform v0.13.0

  • provider registry.terraform.io/hashicorp/external v1.2.0
  • provider registry.terraform.io/hashicorp/google v3.38.0
  • provider registry.terraform.io/hashicorp/google-beta v3.38.0
  • provider registry.terraform.io/hashicorp/random v2.3.0
  • provider registry.terraform.io/hashicorp/template v2.1.2

Affected Resource(s)

google_access_context_manager_access_policy

Terraform Configuration Files

resource "google_access_context_manager_access_policy" "default" {
  parent = "organizations/${local.org_id}"
  title  = "default policy"
}

Debug Output

NA

Panic Output

NA

Expected Behavior

policy should be imported.

Actual Behavior

terraform import google_access_context_manager_access_policy.default {{592092450000}}
google_access_context_manager_access_policy.default: Importing from ID "{{592092450000}}"...

Error: nil entry in ImportState results. This is always a bug with
the resource that is being imported. Please report this as
a bug to Terraform.

Steps to Reproduce

NA

Important Factoids

NA

References

NA

@ghost ghost added the bug label Sep 25, 2020
@edwardmedia edwardmedia self-assigned this Sep 25, 2020
@edwardmedia
Copy link
Contributor

@frasercarter check out this issue to see that helps?

@65156
Copy link
Author

65156 commented Sep 25, 2020

@frasercarter check out this issue to see that helps?

theres no issues visible.

@ghost ghost removed the waiting-response label Sep 25, 2020
@65156
Copy link
Author

65156 commented Sep 25, 2020

you mean this one: #3620? Ill take a look, I didnt see this initially when I searched.

@edwardmedia
Copy link
Contributor

#3620

@65156
Copy link
Author

65156 commented Sep 25, 2020

looks like thats just affecting user credentials, im using a service account for this call with the following roles applied at org level.

  roles_deployment = [ # roles used by the deployment service account for the organization
    "roles/owner",
    "roles/iam.organizationRoleAdmin",
    "roles/billing.user",
    "roles/resourcemanager.organizationAdmin",
    "roles/resourcemanager.folderAdmin",
    "roles/orgpolicy.policyAdmin",
    "roles/accesscontextmanager.policyAdmin",
  ]

@ghost ghost removed waiting-response labels Sep 25, 2020
@edwardmedia
Copy link
Contributor

@frasercarter have you tried import using below format?

terraform import google_access_context_manager_access_policy.access-policy 592092450000

@65156
Copy link
Author

65156 commented Sep 27, 2020

that format does not work the accepted format is as I have written and is as per the documentation.
https://www.terraform.io/docs/providers/google/r/access_context_manager_service_perimeter.html#resources

terraform import google_access_context_manager_access_policy.default {{name}} 

I have tried different combinations including the one you have suggested and the typical error is returned as the resource is not found.


ignore that, it just worked and you were correct; I just noticed that its associating the policy with whatever project the service account lives in *; I was using another service account for testing and the API was not enabled, not sure why it wasnt working previously.

terraform import google_access_context_manager_access_policy.default name

google_access_context_manager_access_policy.default: Importing from ID "592092450000"...
google_access_context_manager_access_policy.default: Import prepared!
Prepared google_access_context_manager_access_policy for import
google_access_context_manager_access_policy.default: Refreshing state... [id=592092450000]

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.

Releasing state lock. This may take a few moments...

@ghost ghost removed waiting-response labels Sep 27, 2020
@65156 65156 closed this as completed Sep 27, 2020
@ghost
Copy link

ghost commented Oct 27, 2020

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 as resolved and limited conversation to collaborators Oct 27, 2020
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