PR #80 added support for GCP, which added a new required argument provider_name on mongodbatlas_vpc_peering_connection. I've updated to the documentation to include this argument here: #93 but there doesn't appear to be a way to upgrade an AWS peering_connection to the latest version of the provider without recreating the connection.
Even if you remove the provider from state, and import it again, it still doesn't pick up which provider the connection should be associated with and will attempt to recreate it.
$ tf import mongodbatlas_vpc_peering_connection.example REDACTEDA-REDACTEDB
mongodbatlas_vpc_peering_connection.example: Importing from ID "REDACTEDA-REDACTEDB"...
mongodbatlas_vpc_peering_connection.example: Import complete!
Imported mongodbatlas_vpc_peering_connection (ID: REDACTEDB)
mongodbatlas_vpc_peering_connection.example: Refreshing state... (ID: REDACTEDB)
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 running terraform plan will still attempt to recreate the resource even though it's fine:
PR #80 added support for GCP, which added a new required argument
provider_name
onmongodbatlas_vpc_peering_connection
. I've updated to the documentation to include this argument here: #93 but there doesn't appear to be a way to upgrade an AWS peering_connection to the latest version of the provider without recreating the connection.Even if you remove the provider from state, and import it again, it still doesn't pick up which provider the connection should be associated with and will attempt to recreate it.
This information should be inferable in the response from the MongoDBAtlas API: https://docs.atlas.mongodb.com/reference/api/vpc-get-connection/.
Version
Tested on both TF 11.13 and TF 12.2 with version 1.1.0 of the MongoDBAtlas provider.
Example
Sample config:
If you attempt to run
tf plan
without the newprovider_name
argument:If you add the
provider_name
argument, you then have to recreate the resource regardless.Removing the existing state:
Reimporting:
Then running
terraform plan
will still attempt to recreate the resource even though it's fine:Expectation
I shouldn't have to recreate a connection (or manually hack the state) after import because of the
provider_name
block.Reality
You cannot currently import an AWS
mongodbatlas_vpc_peering_connection
.