Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Duplicate resource errors when using indexed resources #303

Open
@bamhm182

Description

@bamhm182

Problem

When creating multiple resources within acount orfor_each loop, you end up with multiple resources using the same label as seen in theterraform graph output. TheConvertState function withinproviders/terraform/resources.go sees references to these resources as a problem since they share the same label and fails to let you use them.

Use Case

Below is a simple example which creates 5 random passwords and attempts to makecoder_metadata resources for them. While this instance usescoder_metadata, a similar result also occurs with many of the othercoder_* resource types.

terraform {  required_providers {    coder = { source = "coder/coder" }    random = { source = "hashicorp/random" }  }}resource "random_password" "passwords" {  count = 5  length = 20}resource "coder_metadata" "meta_passwords" {  count = length(random_password.passwords)  resource_id = random_password.passwords[count.index].id}

What I Want

5coder_metadata resources, one for each of the generatedrandom_password resources.

What I Get

Error during the buildtemplate import provision for start: duplicate metadata resource: random_password.passwords

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp