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

bug: Import for policy exception is broken in terraform 1.8.x #637

Open
lonelyelk opened this issue May 13, 2024 · 3 comments
Open

bug: Import for policy exception is broken in terraform 1.8.x #637

lonelyelk opened this issue May 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@lonelyelk
Copy link
Contributor

Describe the bug

The documentation command for import doesn't work. It fails with usage error:

The import command expects two arguments.
Usage: terraform [global options] import [options] ADDR ID

...

Trying to import by ID doesn't work either as the code executed by terraform is not the code in the provider (judging by the output)

  1. Creating import block doesn't work
import {
  id = '11111111-2222-3333-4444-555555555555'
  to = lacework_policy_exception.example
}

Running terraform plan -generate-config-out=generated.tf produces:

lacework_policy_exception.example: Preparing import... [id=11111111-2222-3333-4444-555555555555]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: unable to import Lacework resource. Policy Exception with guid '11111111-2222-3333-4444-555555555555' was not found
│
│

Same goes when creating a resource with policy_id value and running terraform import lacework_policy_exception.example 11111111-2222-3333-4444-555555555555. But the output is slightly different: lacework_policy_exception.example: Importing from ID ...

To Reproduce

Steps to reproduce the behavior:

  1. Create a policy exception in UI
  2. Try to import it in terraform while using terraform 1.8.x

Alternatively:

  1. Create a policy exception using terraform
  2. Run terraform state rm lacework_policy_exception.example
  3. Try to import it back knowing all the IDs while using terraform 1.8.x

Expected behavior

I think using UUID implies that finding a policy exception using its ID only should be possible. I'd like to use both: import block and import command (see current docs)

Please complete the following information):

  • OS: macOS Sonoma 14.4.1 (23E224)
  • Provider Version 1.18.2
  • Terraform Version 1.8.1
@lonelyelk lonelyelk added the bug Something isn't working label May 13, 2024
@piotrb
Copy link

piotrb commented Jun 11, 2024

Its not just 1.18 .. it also doesn't seem to work in 1.5.6 .. same issue

@lvets
Copy link

lvets commented Sep 5, 2024

I have the same problem. It's not Terraform, it's the provider.

The import statement states $ terraform import lacework_policy_exception.example YourLQLPolicyID YourExceptionID but that doesn't make sense. In every other provider I've used the part after the resource is always one string, I've never seen two strings divided by a space like that.

@lvets
Copy link

lvets commented Oct 7, 2024

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants