Open andy-nix opened 11 months ago
Code to reproduce could be simplified to:
import pulumi_mongodbatlas as mongodbatlas
org_id = mongodbatlas.get_roles_org_id().org_id
project = mongodbatlas.Project("myproject",
name = "myproject",
org_id = org_id,
is_collect_database_specifics_statistics_enabled = True,
is_data_explorer_enabled = True,
is_performance_advisor_enabled = True,
is_realtime_performance_panel_enabled = True,
is_schema_advisor_enabled = True,
opts = pulumi.ResourceOptions(
delete_before_replace=True
import_= "XXXXXXXXXXXXXX",
ignore_changes = ['is_collect_database_specifics_statistics_enabled', 'is_data_explorer_enabled', 'is_extended_storage_sizes_enabled', 'is_performance_advisor_enabled', 'is_realtime_performance_panel_enabled', 'is_schema_advisor_enabled', 'limits', 'name', 'org_id', 'project_owner_id', 'region_usage_restrictions', 'teams', 'with_default_alerts_settings', 'cluster_count, 'created']
)
)
Have you tried importing resources in a pulumi import
command? Generally, it's less strict and would import the resource state even if the generated code is not perfect. You can then adjust the code and continue managing resources without the import
option.
Not yet, in scope of developing internal developing platform I need ability to do import via code, so I was concentrated on this approach. But I believe I need to check import via CLI at least to compare behavior. I'll let you know a bit later results
I was able to import project via Pulumi CLI but got following warnings during this:
Diagnostics:
mongodbatlas:index:Project (xxx-sandbox):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `mongodbatlas` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: mongodbatlas:index/project:Project resource 'xxx-sandbox' has a problem: Missing required property 'orgId'
And in the end import command finished with error: error: anonymous.pp:3,10-16: undefined variable parent;
But seems it was able to successfully import resource in state since I can see Project resource in output of pulumi stack
and have followin in state:
{
"urn": "urn:pulumi:xxx-sandbox::idp-core::yyy:platform:xxx-sandbox$yyy:idp-module:MongoGlobal$mongodbatlas:index/project:Project::xxx-sandbox",
"custom": true,
"id": "62ccxxxxxxxxxxxxxxx43ef",
"type": "mongodbatlas:index/project:Project",
"outputs": {
"id": "62ccxxxxxxxxxxxxxxx43ef",
"limits": [],
"teams": []
},
"parent": "urn:pulumi:xxx-sandbox::idp-core::yyy:platform:xxx-sandbox$yyy:idp-module:MongoGlobal::xxx-sandbox",
"protect": true,
"provider": "urn:pulumi:xxx-sandbox::idp-core::pulumi:providers:mongodbatlas::default_3_11_1::3bb7ca96-fba1-44ad-a75e-b3234b376563",
"created": "2023-11-01T16:31:53.754265335Z",
"modified": "2023-11-01T16:31:53.754265335Z"
}
So looks like there really some bug in Project resource implementation
Unfortunately, it looks like this issue hasn't seen any updates in a while. If you're still encountering this problem, could you leave a quick comment to let us know so we can prioritize it? (Commenting will bump it back into our triage queue.)
What happened?
I'm trying to do import MongoAtlas project. For this I have transformation that add
import_
andignore_changes
on all fileds for resourceBut when I run
pulumi pre
I receive error:And when I don't add 'org_id' to ingore_changes like defined below:
then I receive drift and message that resource will fail to import:
Note that I able to import other mongoatlas resources in such way, problem happen only with Project
Example
I have complex codebase, but in general to reproduce the error you need only following snippets:
transformation that inject
import_
option:tansformation require following configuration in Stack config:
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).