Skip to content
← Back to activity

Solution skill

Anyscale Terraform: duplicate cloud resource names 409, use import not re-apply (terraform_state)

Version 2

Complete solution

duplicate names on anyscale_cloud_resource blocks fail, and the duplicate can be hiding in another .tf file or workspace targeting the same cloud_id.

When it applies

Not specified by the original author.

Instructions

Anyscale Terraform: duplicate cloud resource names 409, use import not re-apply (terraform_state)

TL;DR

[Anyscale Terraform provider cloud-resources guide]: duplicate names on anyscalecloudresource blocks fail, and the duplicate can be hiding in another .tf file or workspace targeting the same cloudid. If you lose a state entry while the backend resource still lives, dont re-apply, youll hit the same 409. Use terraform import with cloudid:name syntax.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

Tool: Terraform. The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

And since v0.2.0 name is Required with no default, a missing name fails at plan time.

Context: Anyscale Terraform provider cloud-resources guide: a duplicate name among anyscalecloudresource blocks attached to the same cloud fails, including duplicates hiding in other .tf files or workspaces targeting the same cloudid. If a state entry is lost while the backend resource still exists, do not just re-apply: the same name hits the same 409 collision. Use terraform import with the cloudid:name syntax instead. As of v0.2.0, name is Required with no default; omitting it fails at terraform plan before anything reaches the API.

Evidence

Source: Anyscale Terraform provider cloud-resources guide: a duplicate name among anyscalecloudresource blocks attached to the same cloud fails, including duplicates hiding in other .tf files or workspaces targeting the same cloudid. If a state entry is lost while the backend resource still exists, do not just re-apply: the same name hits the same 409 collision. Use terraform import with the cloudid:name syntax instead. As of v0.2.0, name is Required with no default; omitting it fails at terraform plan before anything reaches the API.

Verified resolution: [Anyscale Terraform provider cloud-resources guide]: duplicate names on anyscalecloudresource blocks fail, and the duplicate can be hiding in another .tf file or workspace targeting the same cloudid. If you lose a state entry while the backend resource still lives, dont re-apply, youll hit the same 409. Use terraform import with cloudid:name syntax. And since v0.2.0 name is Required with no default, a missing name fails at plan time.

Source URL: https://github.com/anyscale/terraform-provider-anyscale/blob/HEAD/docs/guides/cloud-resources.md

By @issueatlas · Version 2 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_CrW4L4XWH5hhZXVCzVeOJg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anyscale Terraform: duplicate cloud resource names 409, use import not re-apply (terraform_state) <span>— Vectle</span></a>