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
{{ message }}
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
code works and tested for plan and apply actions on new database instances.
This has previously been an issue in terraform core, but their ticket seems to have been closed for a while now. hashicorp/terraform#11264
After testing numerous ways including the recommended input=false approach, I still cannot get a valid import to work.
Terraform Configuration Files
# ----------------------------##! >> parent module block <<# ----------------------------#data"terraform_remote_state""inventory" {
backend="s3"config={
bucket ="<ommited>"
key ="<ommited>"
region ="eu-west-1"
encrypt =true
}
}
module"mysql_container" {
/* * splat join hack required to deal with non instantiated db instances. * If db count = 0, then mysql resources will not get created. * if db count = 1 (no state transition), resources will be created. ! if db count = 1 and a transition occurs (0 > 1): you will need to do a targetted apply prior on the db*/source="../../modules/mysql_management"endpoint=join("", data.terraform_remote_state.inventory.outputs.rds_map.endpoint)
user=join("", data.terraform_remote_state.inventory.outputs.rds_map.username)
password=join("", data.terraform_remote_state.inventory.outputs.rds_map.password)
service="container"dependancy=null_resource.db_state_checker.id
}
# ------------------------------------------##! >> Lower level in child module block <<# ------------------------------------------#provider"mysql" {
version="~> 1.9"endpoint=var.endpointusername=var.userpassword=var.password
}
resource"mysql_database""db" {
for_each=var.endpoint==""? {} :lookup(local.database, var.service, "")
name=each.keydefault_character_set="latin"defaulty_collation="latin1_swedish_ci"lifecycle {
prevent_destroy=true
}
}
variable"endpoint" {
type=stringdescription="RDS mysql endpoint with port :3306"
}
variable"dependancy" {
description="a variable that causes the module to wait on the null_resource to finish"
}
variable"user" {
type=stringdescription="mysql username for master account"
}
variable"password" {
type=stringdescription="mysql password for master account"
}
Debug Output
module.mysql_container.mysql_database.db["container"]: Importing from ID "container"...2020/06/1817:47:52 [TRACE] EvalImportState: import module.mysql_container.mysql_database.db["container"] "container" produced instance object of type mysql_database
2020/06/1817:47:52 [TRACE] [walkImport] Exiting eval tree: module.mysql_container.mysql_database.db["container"] (import id "container")
2020/06/1817:47:52 [TRACE] vertex "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")": expanding dynamic subgraph
2020/06/1817:47:52 [TRACE] vertex "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")": entering dynamic subgraph
2020/06/1817:47:52 [TRACE] dag/walk: updating graph
2020/06/1817:47:52 [TRACE] dag/walk: added new vertex:"import module.mysql_container.mysql_database.db[\"container\"] result"2020/06/1817:47:52 [TRACE] dag/walk: visiting "import module.mysql_container.mysql_database.db[\"container\"] result"2020/06/1817:47:52 [TRACE] vertex "import module.mysql_container.mysql_database.db[\"container\"] result": starting visit (*terraform.graphNodeImportStateSub)
module.mysql_container.mysql_database.db["container"]: Import prepared!
Prepared mysql_database for import
2020/06/1817:47:52 [TRACE] vertex "import module.mysql_container.mysql_database.db[\"container\"] result": evaluating
2020/06/1817:47:52 [TRACE] [walkImport] Entering eval tree: import module.mysql_container.mysql_database.db["container"] result
2020/06/1817:47:52 [TRACE] module.mysql_container: eval:*terraform.EvalSequence2020/06/1817:47:52 [TRACE] module.mysql_container: eval:*terraform.EvalGetProvider2020/06/1817:47:52 [TRACE] module.mysql_container: eval:*terraform.EvalRefresh2020/06/1817:47:52 [TRACE] GRPCProvider: ReadResource
2020-06-18T17:47:52.360+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:52 [DEBUG] Waiting for state to become: [success]
2020-06-18T17:47:52.360+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:52 [TRACE] Waiting 500ms before next try
module.mysql_container.mysql_database.db["container"]: Refreshing state... [id=container]
2020-06-18T17:47:52.863+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:52 [TRACE] Waiting 1s before next try
2020-06-18T17:47:53.869+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:53 [TRACE] Waiting 2s before next try
2020-06-18T17:47:55.874+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:55 [TRACE] Waiting 4s before next try
2020/06/1817:47:57 [TRACE] dag/walk: vertex "root" is waiting for "module.mysql_container.provider.mysql (close)"2020/06/1817:47:57 [TRACE] dag/walk: vertex "module.mysql_container.provider.mysql (close)" is waiting for "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")"2020-06-18T17:47:59.878+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:47:59 [TRACE] Waiting 8s before next try
2020/06/1817:48:02 [TRACE] dag/walk: vertex "root" is waiting for "module.mysql_container.provider.mysql (close)"2020/06/1817:48:02 [TRACE] dag/walk: vertex "module.mysql_container.provider.mysql (close)" is waiting for "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")"2020/06/1817:48:07 [TRACE] dag/walk: vertex "root" is waiting for "module.mysql_container.provider.mysql (close)"2020/06/1817:48:07 [TRACE] dag/walk: vertex "module.mysql_container.provider.mysql (close)" is waiting for "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")"2020-06-18T17:48:07.880+0100 [DEBUG] plugin.terraform-provider-mysql_v1.9.0_x4:2020/06/1817:48:07 [TRACE] Waiting 10s before next try
2020/06/1817:48:12 [TRACE] dag/walk: vertex "root" is waiting for "module.mysql_container.provider.mysql (close)"2020/06/1817:48:12 [TRACE] dag/walk: vertex "module.mysql_container.provider.mysql (close)" is waiting for "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")"2020/06/1817:48:17 [TRACE] dag/walk: vertex "root" is waiting for "module.mysql_container.provider.mysql (close)"2020/06/1817:48:17 [TRACE] dag/walk: vertex "module.mysql_container.provider.mysql (close)" is waiting for "module.mysql_container.mysql_database.db[\"container\"] (import id \"container\")"
Expected Behavior
The provider is able to receive the provided data sources and able to refresh successfully in order for the import command to be successful.
Actual Behavior
Timeouts seem to point to localhost, despite being given an endpoint, username and password from data resources.
Steps to Reproduce
terraform import -input=false 'module.mysql_container.mysql_database.db["container"] container
or terraform import 'module.mysql_container.mysql_database.db["container"] container
References
This has previously been an issue in terraform core, but their ticket seems to be closed for a while now, and it more resembled their core functionality which may be different for this provider. hashicorp/terraform#11264
The text was updated successfully, but these errors were encountered:
dannyibishev
changed the title
mysql_database import operation stuck on terraform refresh action for the provider.
mysql_database import operation timeouts on terraform refresh action for the provider.
Jun 19, 2020
Terraform Version
Affected Resource(s)
This has previously been an issue in terraform core, but their ticket seems to have been closed for a while now. hashicorp/terraform#11264
After testing numerous ways including the recommended input=false approach, I still cannot get a valid import to work.
Terraform Configuration Files
Debug Output
Expected Behavior
The provider is able to receive the provided data sources and able to refresh successfully in order for the import command to be successful.
Actual Behavior
Timeouts seem to point to localhost, despite being given an endpoint, username and password from data resources.
Steps to Reproduce
terraform import -input=false 'module.mysql_container.mysql_database.db["container"] container
or
terraform import 'module.mysql_container.mysql_database.db["container"] container
References
This has previously been an issue in terraform core, but their ticket seems to be closed for a while now, and it more resembled their core functionality which may be different for this provider. hashicorp/terraform#11264
The text was updated successfully, but these errors were encountered: