Skip to content

Potential ID conflict in portainer_edge_configurations with same name #115

@alofthouse

Description

@alofthouse

Before you start please confirm the following.

  • Yes, I've searched similar issues on GitHub.
  • Yes, I've checked whether this issue is covered/solved in the Portainer Terraform provider discussions.

Problem Description

After the updates in #114 the way the Edge Config ID which is determined by the provider has improved a lot, but there is still an issue where if an existing config with the same name exists in Portainer the provider will select with config's ID instead and so perform update/delete operations on that.

This will seem to remain a limitation of the provider until Portainer returns the ID on a POST request, but it is probably worth documenting to explain the limitation and to warn users against creating configs with the same name.

An "good-enough" alternative would be to look at the created field in the GET /edge_configurations response and assume that the config with the same name which has most recently been created is probably the one just created by the provider.

Expected Behavior

Provider ignores existing edge configurations when creating a new resource with the same name.

Actual Behavior

Provider assigns wrong ID and manages existing edge configuration with same name.

Steps to Reproduce

  1. Manually create edge configuration with name Test in Portainer
  2. Create portainer_edge_configurations resource with name = "Test" in Terraform and apply
  3. Delete Terraform-managed edge configuration
  4. Notice that manually created edge configuration has now been deleted

Logs / Screenshots / Terraform Output

N/A

Affected Resource(s)

portainer_edge_configurations

Terraform Command Used

terraform apply

Relevant Terraform Configuration

Provider Version

1.28.0

Terraform Version

1.14.8

Portainer Version

2.39.1

Platform and Version

No response

OS and Architecture

MacOS ARM64

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions