Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't connect to MySQL Instance when the provider is instantiated #25

Closed
RyanW8 opened this issue Aug 17, 2022 · 4 comments
Closed

Don't connect to MySQL Instance when the provider is instantiated #25

RyanW8 opened this issue Aug 17, 2022 · 4 comments

Comments

@RyanW8
Copy link

RyanW8 commented Aug 17, 2022

Hey we're looking to migrate to this provider away from the deprecated https://github.com/hashicorp/terraform-provider-mysql. However we've hit a bit of a roadblock. This provider seems to attempt to connect to the MySQL instance when the provider is instantiated which is causing problems for us.

We have a wrapper module that allows us to create AWS RDS instances of various engine types (postgres, mysql etc), in this module we declare the MySQL provider so that MySQL engine types can create users; this is causing problems for postgres engine types as obviously the provider won't work. Is it possible to move the connecting to the MySQL instance into the specific resources like it did in the old provider?

@snolan-amount
Copy link

snolan-amount commented Aug 29, 2022

This issue prevents a simple plan too - if your terraform creates a database instance and then uses this provider to work with the new database instance, the plan fails because this provider tries to connect to the instance that doesn't exist.
Using terraform 1.0.9.

@petoju
Copy link
Owner

petoju commented Aug 31, 2022

We could do it now as I understand the rationale. Database could be connected to lazily in resources. It needs some locking, but it can be done.

Bear in mind it brings something (it works with RDS when provisioned specially), but brings a bit of WTF moment - one can make a provider, that seems to work until a resource is created.

@petoju
Copy link
Owner

petoju commented Sep 7, 2022

@RyanW8 @snolan-amount could you test it now? Provider 3.0.20 could behave better. It still needs some testing - while it passed the integration test, I am afraid there could be more issues with it.

@RyanW8
Copy link
Author

RyanW8 commented Sep 26, 2022

Thanks @petoju we've now switched to using this MySQL provider, haven't encountered any issues yet. Thanks!

@petoju petoju closed this as completed Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants