rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
253 stars 216 forks source link

[BUG] Import Mutating Objects #1319

Open matttrach opened 3 months ago

matttrach commented 3 months ago

Rancher Server Setup

Information about the Cluster

User Information

Provider Information

Describe the bug

Importing an object into the terraform state should not mutate the object. When importing a namespace we set the project id. https://github.com/rancher/terraform-provider-rancher2/blob/v4.1.0/rancher2/import_rancher2_namespace.go#L27

To Reproduce

Import an existing namespace using the import cli command.

Actual Result

Namespace is assigned to a project when importing it into terraform.

Expected Result

If the namespace needs to be assigned to a project before importing we should error if the project id is not set.

Screenshots

Additional context

Generally, any importing objects should never mutate those objects. If we want to inform the user that the namespace may not function as expected without belonging to a project we can error or warn the user during the import process, but we should not be changing the namespace in the process.

matttrach commented 3 months ago

I don't have any historical information about this. I will need automatic acceptance tests running before I feel comfortable removing this since it was added as a "feature".