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

PostgreSQL provider #3650

Closed
ringods opened this issue Oct 27, 2015 · 8 comments
Closed

PostgreSQL provider #3650

ringods opened this issue Oct 27, 2015 · 8 comments
Labels

Comments

@ringods
Copy link
Contributor

ringods commented Oct 27, 2015

One of the last pieces missing for me to complete a full Terraform setup is a PostgreSQL provider. One of my colleagues is already working on this, but I wanted to chime in to see whether this work could get accepted upstream.

My AWS setup ends currently with the creation of an RDS instance, but I want the ability to create more than one database on this server, with more than a single owner role. That's what the PostgreSQL provider is for.

The initial resources which will be supported are:

  • postgresql_role
  • postgresql_database

An example of how it would show in Terraform:

# These are the PostgreSQL resources I would like to create:
resource "postgresql_role" "rq_db_user" {
  host = "${aws_db_instance.rq_web_api_rds.address}
  username = "${var.admin_user}"
  password = "${var.admin_password}"
  name = "rq_database_user"
  login = "true"
}

resource "postgresql_db" "rq_database" {
  host = "${aws_db_instance.address}
  username = "${var.admin_user}"
  password = "${var.admin_password}"
  name = "rq_database"
  owner = "${postgresql_role.rq_db_user.name} 
}

If this is something which might be helpful for Terraform, we will submit a pull request shortly to accompany this ticket.

@ringods
Copy link
Contributor Author

ringods commented Oct 27, 2015

@catsby I very much hope this ends in upstream. A general remark I have is that any provider which doesn't make it in upstream, can't be used in Atlas. Or are you guys working on a way for Atlas to pull third-party providers?

@mvdkleijn
Copy link

Possibly a silly question from my end, but wouldn't this fall into the realm of a Chef provisioner instead of a provider?

If I understood correctly, providers exist to provide the "hardware" (of sorts) and the provisioners to configure / setup that hardware further. Seems to me that PostgreSQL would be a classic example of "provisioning software on hardware provided by XYZ" (openstack for example)

Edit: in other words... you'd probably be better off writing a Chef cookbook?

@apparentlymart
Copy link
Contributor

This seems like a natural complement to #3122, with similar motivations.

In particular, provisioning the database with Chef implies that the database is running on a server to which you have SSH access. That is not true when you are using a service like Amazon RDS where the only access you have is via the database's native network protocol.

@mvdkleijn
Copy link

I can see your point regarding RDS. My feeling is that this should be a provisioner instead of a provider, but I was just curious. 😄

@ringods
Copy link
Contributor Author

ringods commented Oct 29, 2015

@mvdkleijn My take on having the PostgreSQL support as a provider comes from Terraform's own documentation:

Terraform provides a flexible abstraction of resources and providers. 
This model allows for representing everything from physical hardware, 
virtual machines, and containers, to email and DNS providers.

You can use a provisioner to install bind and it's configuration on a Linux machine, but if you want to rely on DNS as a service, then it's well suited for a provider. In my view, DNS is not much different from a database service. In the AWS RDS case, you get a pre-provisioned machine with PostgreSQL. From there on, I consider it PostgreSQL-as-a-Service, which then matches the Terraform description of a provider.

My short-sighted view:

  • if you have to do it on the system: provisioner
  • if you have to do it remotely: provider

@ringods
Copy link
Contributor Author

ringods commented Nov 6, 2015

Given the fact the Google SQL provider (instance+database) pull request (#3617) is merged into upstream, I think the generic PostgreSQL provider pull request (#3653) and generic MySQL provider pull request (#3122) should end up in 0.6.7 too!

All of this database support in the same version, now wouldn't that be handy? :-)

@apparentlymart
Copy link
Contributor

This was fixed by closing #3653. If folks want to add additional resources to this provider, let's make separate issues and/or pull requests for those.

@ghost
Copy link

ghost commented Apr 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants