You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to import an non existing resource, We get only errored variable is set to "true" in plan.json, but not the actual modules or resources addresses which will import the id is not listed in plan.json. Though the Error outputs message as below text . Could you please add the resources or modules addresses which are failing in import as part of the plan.json.
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to
│ "module.spoke-network.azurerm_resource_group.spoke["rg-spoke"]",
│ the provider detected that no object exists with the given id. Only
│ pre-existing objects can be imported; check that the id is correct and that
│ it is associated with the provider's configured region or endpoint, or use
│ "terraform apply" to create a new remote object for this resource.
Can you say more about what you are intending to do with this information if it were added? That will help both to understand the value of adding this new information and to make sure that what is added would actually meet your goal.
Step 1: This tool will create import blocks from running a terraform plan towards modules/resources and generate the id and to address
Step 2: After generating the import blocks again it will run plan to check it is an existing resources or not. and remove the import block if it is a non-existing resources.
NEED FOR THE FEATURE:
Terraform plan shows only error output rather than showing it in plan.json. If the non-existing resources import blocks are displayed as part of plan.json, then it will be easy to pick the list from plan.json and it can remove those import blocks.
Currently i'm picking the errored import block address(modules/resource) from standard errors and redefining it to get the module/resource address.
So if this feature added , then i could pick it from plan.json which is pretty straight forward and easy to implement.
The Terraform team will consider what it would take to achieve what you've proposed, and also consider other possible ways to achieve the same effect that might be more straightforward to implement. This isn't an area of immediate focus right now, so I want to be explicit that you might not get a further response immediately, but we'll leave this issue open to represent the use-case.
In the meantime, if others find this issue and have a similar use-case it would help if you could leave a comment with some similar context about what you are trying to achieve, and to add a 👍 reaction to the original issue comment (not to this comment) which the Terraform team uses as one signal for prioritizing which areas to consider next. Thanks!
Terraform Version
Use Cases
While trying to import an non existing resource, We get only errored variable is set to "true" in plan.json, but not the actual modules or resources addresses which will import the id is not listed in plan.json. Though the Error outputs message as below text . Could you please add the resources or modules addresses which are failing in import as part of the plan.json.
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to
│ "module.spoke-network.azurerm_resource_group.spoke["rg-spoke"]",
│ the provider detected that no object exists with the given id. Only
│ pre-existing objects can be imported; check that the id is correct and that
│ it is associated with the provider's configured region or endpoint, or use
│ "terraform apply" to create a new remote object for this resource.
Sample plan.json
{
"timestamp": "2024-05-08T13:34:31Z",
"applyable": false,
"complete": false,
"errored": true
}
Attempted Solutions
Expected plan.json
{
"timestamp": "2024-05-08T13:34:31Z",
"applyable": false,
"complete": false,
"errored": true
"cannot_import_non_existent_remote_object": [
"module.spoke-network.azurerm_resource_group.spoke["rg-spoke"]"
]
}
Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered: