Closed CherylFlowers closed 1 year ago
Thanks @CherylFlowers attempting to reproduce issue, in the interim can you share any error logs? best if you can set export TF_LOG=TRACE
and output results to file. More details here on how to do this if helpful.
@CherylFlowers I would need module code to attempt to reproduce error module.mongodbatlas_project.mongodbatlas_federated_settings_org_config.org_connection needs to be imported as first step so I would need this to do the required steps
Thank you @Zuhairahmed and @martinstibbe for your speedy replies!
I'm working with a colleague to get those trace logs to you, apologies for the wait on that one.
As for the module code, again apologies for the confusion on the tf config, I was trying to simplify the bug report. I've attached the main.tf which contains the client code, and the module.tf which contains our module code. There are additional module calls and I didn't include that source code as I don't think it's relevant (ie. private endpoints, tags etc.), however if you need that as well please let me know.
--- edit ---
And the vars as well; vars.txt
Hi @Zuhairahmed and @martinstibbe
I'm working with @CherylFlowers on this issue and have rerun a terraform deploy and have attached associated files along with a trace file. If you need something else, please let me know.
Thanks terraform_plan.txt mongodb-test-federation.tf.txt trace.log
@horochj @CherylFlowers
ok thanks I used a portion of your module to replicate issue
if I just do a direct terraform init then terraform apply I get error
Error: Provider produced inconsistent result after apply │ │ When applying changes to module.mongodbatlas_project.mongodbatlas_federated_settings_org_config.org_connection, provider │ "provider[\"registry.terraform.io/mongodb/mongodbatlas\"]" produced an unexpected new value: Root resource was present, but now │ absent. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker.
But if I import module first via terraform import module.mongodbatlas_project.mongodbatlas_federated_settings_org_config.org_connection orgid-federatedsettings-id
I get ... `Import successful!
The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform.`
Then a terraform apply yields
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
So it appears to just be import step is missing to correct the error you are encountering
In this case, it would appear that the mongodbatlas_federated_settings_org_config.org_connection
resource is not being reported back to the state file. The mongodbatlas_federated_settings_org_config
is a new resource being implemented in the tf config that was provided. So in a usual terraform workflow of init
, plan
, apply
, one should not have to run an import
, it should be done automatically.
Also, the error from Terraform (Root resource was present, but now absent. This is a bug in the provider, which should be reported in the provider's own issue tracker.
) indicates that the plan
returned a non-null object (intent to create), but the apply
returned a null object (doesn't exist at all).
Perhaps I'm misunderstanding how the mongodbatlas_federated_settings_org_config
should be implemented? I welcome your suggestions and insight.
In this case, it would appear that the
mongodbatlas_federated_settings_org_config.org_connection
resource is not being reported back to the state file. Themongodbatlas_federated_settings_org_config
is a new resource being implemented in the tf config that was provided. So in a usual terraform workflow ofinit
,plan
,apply
, one should not have to run animport
, it should be done automatically.Also, the error from Terraform (
Root resource was present, but now absent. This is a bug in the provider, which should be reported in the provider's own issue tracker.
) indicates that theplan
returned a non-null object (intent to create), but theapply
returned a null object (doesn't exist at all).Perhaps I'm misunderstanding how the
mongodbatlas_federated_settings_org_config
should be implemented? I welcome your suggestions and insight.
Yes there is a requirement to import ... per Documentation website/docs/r/federated_settings_org_config.html.markdown
~> IMPORTANT You MUST import this resource before you can manage it with this provider.
Thank you for the details @martinstibbe. Closing this issue as we have the info we need.
Terraform CLI and Terraform MongoDB Atlas Provider Version
Terraform Configuration File
Steps to Reproduce
terraform init
terraform plan -out ./terraform.plan
terraform apply ./terraform.plan
Expected Behavior
Plan should apply with no errors.
Actual Behavior
Note that the error below references a module, however the source code above does not contain a module. I've purposely flattened the Terraform config in an effort to simplify the bug report. However please let me know if you need the module source code as well, I'm happy to provide more details.
Debug Output
Crash Output
Additional Context
References