Closed fabian-kramer closed 2 months ago
Hi @fabian-kramer hmm not sure what is going on here. Can you maybe share the terraform resource that is causing this, and if possible a way to reproduce the error?
Hi @demeyerthom, yes of course.
resource "commercetools_shipping_zone_rate" "Stadard-Shipping-Germany-zone-rate" {
price {
cent_amount = 100
currency_code = "EUR"
}
shipping_method_id = commercetools_shipping_method.Stadard-Shipping-Germany.id
shipping_zone_id = commercetools_shipping_zone.Germany.id
}
I could also find out why it was failing. After creating a new resource of that type, I could find the id structure to get the correct import command.
So instead of:
terraform import commercetools_shipping_zone_rate.Stadard-Shipping-Germany-zone-rate EUR
I had to use this command:
terraform import commercetools_shipping_zone_rate.Stadard-Shipping-Germany-zone-rate id-xyz-abc-123@id2-xyz-abc-123@EUR
I think if you create a resource like mine in Commercetools and then try to import it like I tried, then you should get the same error.
Hi @fabian-kramer hmm I think you found the correct way of doing the import here. commercetools_shipping_zone_rate
is not an actual resource that exists in Commercetools, but rather an entity we build in the provider to make the resource management a bit cleaner. To do this however we needed a composite ID to be able to identify which shipping zone rate we are talking about. That ID is in the format of {shipping-method-id}@{shipping-zone-id}@{currency}
(which you figured out above)
This is intended behaviour (which I was also not aware of until now :P) but not very well documented. I will update the docs to reflect this.
Hi, I need to import the already existing shipping zone rates. Unfortunately, this error occurred when executing the import command.
As I couldn't find any documentation or hint as to what the proper ID (if it exists) for the zone rate is, I tried it with "EUR" as the currency seems to be the unique factor. I hope you can help me here. Maybe it's not even a bug but a usage error. In that case, I'd be happy for some assistance.