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

Add database parameter on function resource #216

Merged
merged 3 commits into from
Jun 17, 2022
Merged

Add database parameter on function resource #216

merged 3 commits into from
Jun 17, 2022

Conversation

LucasBoisserie
Copy link
Contributor

Overview

This allows specifying database when creating a function.

Actual behavior

When creating a function is always created in the provider's database.

@cyrilgdn cyrilgdn self-requested a review May 29, 2022 17:27
@LucasBoisserie
Copy link
Contributor Author

any update @cyrilgdn ?

Copy link
Owner

@cyrilgdn cyrilgdn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @LucasBoisserie ,

Thanks a lot for your work 😊
It seems good to me 👍

@cyrilgdn cyrilgdn merged commit 924be53 into cyrilgdn:master Jun 17, 2022
@LucasBoisserie LucasBoisserie deleted the feat/function-with-custom-database branch June 20, 2022 11:12
@afterdesign
Copy link

@cyrilgdn is there option to release this as 1.6.1/1.7.0 ? I just stumbled on this issue while working on pghero permissions.

@graham1228
Copy link

@cyrilgdn I'm also interested in using this. Is it possible to release master with this code?

@ghost
Copy link

ghost commented Aug 16, 2022

@cyrilgdn this is also blocking something I'm working on. Obviously it's OSS so no-one has any claim on anyone's time - just wondering what the timeline is on the release for this so I know whether I can go ahead with using this provider.

@ghost
Copy link

ghost commented Aug 17, 2022

For anyone else waiting for this to be released, there are two (or maybe three) potential workarounds:

  1. If the database you want to add the function to already exists (i.e. isn't being created elsewhere in the same terraform), you can create an aliased provider instance just for the function so the postgresql_function resource will pick up the aliased provider's default database
  2. If the database you want to add the function to is being created in the same terraform as the function itself, you won't be able to do this because the aliased provider won't initialise properly due to the database not existing yet. If you're in this situation, you can create a separate terraform stack entirely - so you run terraform apply on one stack to deploy your database, and then run terraform apply on a second stack to deploy your function
  3. If you create the aliased provider inside a sub-module it might be possible to solve the problem outlined in option 2 by using terraform apply --target... to do a targeted apply. I haven't tried this though so I don't know whether it'll work in practice.

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

Successfully merging this pull request may close these issues.

4 participants