hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
249 stars 114 forks source link

Better documentation for import of resources with composite identifiers #696

Closed ewbankkit closed 1 month ago

ewbankkit commented 1 year ago

Community Note

Description

Resources can be imported using the resource's primary identifier. Usually the format of this identifier is "obvious" but there are some resources whose primary identifier is a composite key. When the documentation for the resource is generated we should do a better job of calling out the ID's format: https://github.com/hashicorp/terraform-provider-awscc/blob/c5f88170f21cad8e2b91ec4a5f1ac70b60d69718/internal/provider/generators/import-examples/main.go#L83

Relates https://github.com/hashicorp/terraform-provider-awscc/issues/688.

patbernard commented 1 year ago

This will help for more than just for composite identifiers. I came here while running into issues importing awscc_chatbot_slack_channel_configuration, as the documentation said to use resource ID. Turns out it was resource ARN I needed to use, but that wasn't obvious. This may be due to me being used to documentation explicitly saying arn, name, or id. But in those cases, the AWS Console also shows id.

https://github.com/hashicorp/terraform-provider-awscc/blob/6a490c2caa165e53d84330106221db744e63c556/internal/service/cloudformation/schemas/AWS_Chatbot_SlackChannelConfiguration.json#L80

If the documentation instead of saying resource ID said properties/Arn (whatever the primaryIdentifier is), it may make this clearer.