turbot / terraform-provider-turbot

Terraform Turbot provider
https://www.terraform.io/docs/providers/turbot/
Mozilla Public License 2.0
7 stars 4 forks source link

turbot_policy_pack_attachment consistently detects that the attachment is needed but fails to complete the process because the Policy Pack is already attached #181

Closed Subhajit97 closed 1 month ago

Subhajit97 commented 1 month ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

# Create a folder
resource "turbot_folder" "workspace_base_folder" {
  parent      = "tmod:@turbot/turbot#/"
  title       = "Sandbox"
  description = "Base folder for the Workspace"
  akas        = ["my_base_folder_resource_aka"]
}

# Create Policy Pack
resource "turbot_policy_pack" "test_baseline_pack" {
  parent = "tmod:@turbot/turbot#/"
  title  = "Test Policy Pack to Attach to resource AKA"
}

# Attach the Policy Pack to the Folder
resource "turbot_policy_pack_attachment" "baseline_pack_attachment" {
  resource    = "my_base_folder_resource_aka"
  policy_pack = turbot_policy_pack.test_baseline_pack.id
}

Debug Output

$ terraform apply turbot_folder.workspace_base_folder: Refreshing state... [id=332488175916773] turbot_policy_pack.test_baseline_pack: Refreshing state... [id=332488175770336] turbot_policy_pack_attachment.baseline_pack_attachment: Refreshing state... [id=332488175770336_my_base_folder_resource_aka]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

turbot_policy_pack_attachment.baseline_pack_attachment will be created

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

turbot_policy_pack_attachment.baseline_pack_attachment: Creating... ╷ │ Error: error creating smart folder attachment: parent resource not found: %!s() │ │ with turbot_policy_pack_attachment.baseline_pack_attachment, │ on main.tf line 25, in resource "turbot_policy_pack_attachment" "baseline_pack_attachment": │ 25: resource "turbot_policy_pack_attachment" "baseline_pack_attachment" { │ ╵

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

What should have happened?

Actual Behavior

What actually happened?

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Creates a folder
  2. Creates a policy pack
  3. Attaches the policy pack to the above resource
  4. Execute the above, it creates the resources and attaches the Policy Pack fine for the first time.
  5. Run the same again, terraform should not see any changes ideally, but it says attachment is needed and tries to attach but fails..

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: