terraform-aws-msk-kafka-cluster icon indicating copy to clipboard operation
terraform-aws-msk-kafka-cluster copied to clipboard

Cannot correctly import MSK configuration

Open ajax-koval-i opened this issue 1 year ago β€’ 2 comments

Description

In your module, the resources aws_msk_configuration and random_id are used.

If the aws_msk_configuration resource was created manually or by another module and was given a simple name, for example, example-configuration, when importing this resource into your module, the aws_msk_configuration will always be recreated since you use the random_id resource in the configuration name.

It would be great to have the option to correctly import resources into your public module.

For example, by adding the ability to disable the random-id suffix at the end of the name.

Versions

  • Module version: 2.6.0

  • Terraform version: Terraform v1.9.3

  • Provider version(s): provider registry.terraform.io/hashicorp/aws v5.53.0 provider registry.terraform.io/hashicorp/random v3.6.0

Reproduction Code [Required]

  1. State list Screenshot 2024-08-28 at 18 27 36

  2. Importing resource aws_msk_configuration.this[0] command: terragrunt import 'aws_msk_configuration.this[0]' arn:aws:kafka:eu-west-3:xxxxxxxxxxxx:configuration/xxxxx-xxxxxx/xxxxxxxx-xxxx-4ddb-9f0f-5785e60adbd6-3 Screenshot 2024-08-28 at 18 32 01 Import successful

  3. terragrunt plan comand output: edited

Force replacement here (recreate of the resource).

  1. Block of code for aws_msk_configuration: edited too

NAMES ARE IDENTICAL (in code, and in aws) Forces replacement here only for one reason - you added random_id resource at the end of the configuration name Here is permalink

Expected behavior

Adding the ability to omit the random_id resource from the end of the configuration name

Actual behavior

Cannot correctly import resources to public module.

ajax-koval-i avatar Aug 28 '24 15:08 ajax-koval-i

this was intended based on user feedback - without it, if you make a change to the configuration and try to apply it, it fails with a "this resource already exists" message. so the random part was added to allow folks to modify the configs and apply it.

If you are importing, I would suggest letting Terraform replace the configs and you're now adopted into the module. If you want to modify this config in the future, you'll inevitably face this issue

bryantbiggs avatar Aug 28 '24 19:08 bryantbiggs

see #17

bryantbiggs avatar Aug 28 '24 22:08 bryantbiggs

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Sep 28 '24 00:09 github-actions[bot]

This issue was automatically closed because of stale in 10 days

github-actions[bot] avatar Oct 09 '24 00:10 github-actions[bot]

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Nov 08 '24 02:11 github-actions[bot]