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 entity into the state automatically during plan/apply execution #533

Open
roman-sokolovych-valtech opened this issue Oct 28, 2024 · 1 comment
Labels
question Further information is requested

Comments

@roman-sokolovych-valtech

I have an issue with the terraform apply command during the GitHub action execution if some entity was already manually created in the commercetools with the same "key".

image

Is it possible automatically import entity by key into the terraform state if is was already created in the commercetools manually?

@roman-sokolovych-valtech roman-sokolovych-valtech added enhancement New feature or request triage Needs triage labels Oct 28, 2024
@demeyerthom demeyerthom added question Further information is requested and removed enhancement New feature or request triage Needs triage labels Nov 1, 2024
@demeyerthom
Copy link
Member

Hi @roman-sokolovych-valtech did you run an import for that same resource beforehand? Like terraform import commercetools_product_type.test_type_creation? This way terraform will take the existing type into state.

Commercetools does not allow multiple entities with the same key, so the error happens because terraform tries to create a new resource based on it missing in state, but encounters an error in CT because the key exists

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

No branches or pull requests

2 participants