Skip to content

Support Terraform import for emqxcloud_deployment (0.2.0) #4

Description

@zibuyu1995

Target: 0.2.0. Not for the 0.1.0 release, which documents import as unsupported.

Problem

No resource implements ImportState. Combined with the deployment lifecycle boundary, emqxcloud_deployment becomes a one-way door:

create deployment -> provider refuses delete -> terraform state rm to release
                  -> Terraform can never manage that deployment again

After terraform state rm, a deployment remains readable through the emqxcloud_deployment data source but cannot be managed by any resource. Live deployment identifiers and cleanup ownership are intentionally tracked outside this public issue.

The provider can read a deployment by ID but cannot adopt one. Any lost state file or mistaken state rm therefore requires manual recovery.

Suggested scope

  • Add ImportState to emqxcloud_deployment, keyed by deployment_id, and populate immutable attributes through the Platform API read path.
  • Define handling for deployment_name and a missing deployment_version.
  • Consider import for Deployment API resources whose identities are already well defined (type:name, rule_id, user_id, as/who).
  • Update README.md, docs/index.md, and templates/*.tmpl, which currently state that import is unsupported.

This changes externally visible behavior, so it requires a confirmed development document first, per AGENTS.md.

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