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 doesn't work for datadog_sensitive_data_scanner_*, datadog_restriction_policy #2367

Closed
ixolt opened this issue Apr 18, 2024 · 1 comment · Fixed by #2485
Closed

Import doesn't work for datadog_sensitive_data_scanner_*, datadog_restriction_policy #2367

ixolt opened this issue Apr 18, 2024 · 1 comment · Fixed by #2485
Labels

Comments

@ixolt
Copy link

ixolt commented Apr 18, 2024

Datadog Terraform Provider Version

v3.38.0

Terraform Version

v1.8.0

What resources or data sources are affected?

datadog_sensitive_data_scanner_group
datadog_sensitive_data_scanner_rule
datadog_restriction_policy

Terraform Configuration Files

resource "datadog_sensitive_data_scanner_rule" "myrule" {
  lifecycle {
    // Use this meta-argument to avoid disabling the group when modifying the 
    // `included_keyword_configuration` field
    create_before_destroy = true
  }
  name                = "My new rule"
  description         = "Another description"
  group_id            = datadog_sensitive_data_scanner_group.mygroup.id
  excluded_namespaces = ["username"]
  is_enabled          = true
  pattern             = "myregex"
  tags                = ["sensitive_data:true"]
  text_replacement {
    number_of_chars    = 0
    replacement_string = ""
    type               = "hash"
  }
  included_keyword_configuration {
    keywords        = ["cc", "credit card"]
    character_count = 30
  }
}

Relevant debug or panic output


│ Error: The provider returned a resource missing an identifier during ImportResourceState. This is generally a bug in the resource implementation for import. Resource import code should not call d.SetId("") or create an empty ResourceData. If the resource is missing, instead return an error. Please report this to the provider developers.


Expected Behavior

imported resource

Actual Behavior

error

Steps to Reproduce

terraform import datadog_sensitive_data_scanner_rule.new_list ""

Important Factoids

No response

References

No response

@ixolt ixolt added the bug label Apr 18, 2024
@ixolt ixolt changed the title Import doesn't work for datadog_sensitive_data_scanner_* Import doesn't work for datadog_sensitive_data_scanner_*, datadog_restriction_policy Apr 18, 2024
@nkzou
Copy link
Contributor

nkzou commented Jul 11, 2024

It seems like you're passing an empty id into the import command - terraform import datadog_sensitive_data_scanner_rule.new_list "", you need to pass in an ID so terraform knows which resource to import. I see that this command was from the docs, I will update the docs to make this clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants