Skip to content

Import: provider improperly renamed #38161

@yherve

Description

@yherve

Terraform Version

Terraform v1.14.5
on linux_amd64

Terraform Configuration Files

main.tf

terraform {
  required_providers {
    smc = {
      source  = "forcepoint/fp-ngfw-smc"
      version = "0.0.1"
    }
  }
}
provider "smc" {
  url          = var.url
}
import {
  id = "http://mysmc:18082/7.5/elements/single_fw/1649"
  to = smc_single_fw.tf_imported_fw
}

generatd.tf

# __generated__ by Terraform
# Please review these resources and move them into your main configuration files.

# __generated__ by Terraform from "http://mysmc:18082/7.5/elements/single_fw/1649"
resource "smc_single_fw" "tf_imported_fw" {
  provider                          = fp-ngfw-smc
...

Debug Output

So no debug output relevant here: Here is what happens:

We are developping a terraform provider where the "internal" name used for resources is "smc" (eg smc_single_fw) and the "external" name in the registry is fp-ngfw-smc
When we add an "import block" and use the "terraform plan" to generate an import, it uses the external name instead of the internal name (see expected behaviour below)

Expected Behavior

resource "smc_single_fw" "tf_imported_fw" {
  provider                          = smc

Actual Behavior

resource "smc_single_fw" "tf_imported_fw" {
  provider                          = fp-ngfw-smc

Steps to Reproduce

  1. terraform init
  2. terraform plan -generate-config-out=generated.tf

Additional Context

No response

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimportImporting resources

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions