-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
provider/aws: WIP Docs for RDS Cluster, Cluster Instance (Aurora) #2935
Conversation
@catsby does this PR mean that Terraform can already manage aurora? |
@stack72 when this PR gets merged, yes. Or you can build based off of the branch if you want, but I put it through some paces with no real troubles 😄 Feedback on the code, or how it works, most welcome! |
@catsby perfect - i'll have a look at it tomorrow. I'm already running my tf version from master so switching branches is fine :) Will feedback when i test it out |
return fmt.Errorf("[WARN] Error waiting for RDS Cluster state to be \"available\": %s", err) | ||
} | ||
|
||
// tags := tagsFromMapRDS(d.Get("tags").(map[string]interface{})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be cleaned up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 998749d
.... sadly I ripped it out. It turns out you can make tags on creation, but you can't list or update them because it's not documented how to make an ARN for an RDS Cluster 😦 ... opening a support ticket for that.
oh i see you have a PR ! Ignore my other comment :) |
@catsby i'm curious why you've taken the approach of making aurora a separate resource, when it's really just a different RDS engine? Unless amazon has a totally different API for this... |
Does aurora support parameter groups / option groups? Those are fairly important from an administrative perspective for DBAs |
I really like the lifecycle concept if it works as expected. Currently aurora offers the prospect of not needing to take downtime to scale storage, but with 'create before destroy' it would be super cool if you didn't have to take downtime to change instance sizes, which seems to be the case. |
It is kind of just a new engine. Mostly. But there exists things like the The DB instances themselves are much more similar, and maybe we could consider scrapping Furthermore, DB Instance requires some fields that an Aurora instance may not, for instance An even better example is
Yes! I have not implemented them yet. They are entirely separate APIs, and I wanted to get a foundation laid for Aurora before tackling those. Better yet, a community member may chip in 😄 . This is also just a proposal (separate resources vs. piggy backing on db instance). I wanted to get enough out there to 👍 / 👎 the idea, before spending time on those other things. I do realize those are important, I'm sorry they aren't included here, but we'll get them.
I tested this! In the example above, you can change Or course, I had essentially zero data in them, so there may exist a possibility of some weirdness (?). The Cluster uses a shared volume though, so I would think not... again, more ✨ |
@catsby thanks for the thorough reply! I'm super pumped, and playing with this branch right now. Now that I read a bit more, i think the separation of 'cluster' and 'instance' makes a lot of sense here 👍 I'll keep my eyes peeled. I'd love to see this get merged, and would be happy to help get option/parameter group support added :) |
Hmm, are you working with VPCs at all? I'm having some weird issues when I try the below code with a VPC that already exists, defined in a remote state:
Gives me:
|
@dalehamel ah, no, I had not. I was able to reproduce with your excellent example, and added resource "aws_rds_cluster" "default" {
cluster_identifier = "tf-aurora-cluster"
database_name = "mydb"
master_username = "foo"
master_password = "mustbeeightcharaters"
vpc_security_group_ids = [ "${aws_security_group.main.id}" ]
db_subnet_group_name = "${aws_db_subnet_group.rds_public_subnet_group.name}"
lifecycle {
create_before_destroy = true
}
}
resource "aws_rds_cluster_instance" "bar" {
count = 1
cluster_identifier = "${aws_rds_cluster.default.id}"
instance_class = "db.r3.large"
db_subnet_group_name = "${aws_db_subnet_group.rds_public_subnet_group.name}"
}
resource "aws_db_subnet_group" "rds_public_subnet_group" {
name = "aurora-rds-public-subnetgroup"
description = "Public subnets for RDS instance"
subnet_ids = [
"${aws_subnet.main.id}",
"${aws_subnet.other.id}",
"${aws_subnet.third.id}",
]
}
resource "aws_subnet" "main" {
vpc_id = "${aws_vpc.foo.id}"
availability_zone = "us-west-2a"
cidr_block = "10.0.1.0/24"
}
resource "aws_subnet" "other" {
vpc_id = "${aws_vpc.foo.id}"
availability_zone = "us-west-2b"
cidr_block = "10.0.2.0/24"
}
resource "aws_subnet" "third" {
vpc_id = "${aws_vpc.foo.id}"
availability_zone = "us-west-2c"
cidr_block = "10.0.3.0/24"
}
resource "aws_vpc" "foo" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
tags {
Name = "rds-subnet-vpc"
}
}
resource "aws_security_group" "main" {
name = "rds-sg"
description = "Allow MySQL traffic to rds"
vpc_id = "${aws_vpc.foo.id}"
} |
❤️ @catsby |
@phinze Also ready for review, but may take more time so whenever you get a moment |
@@ -0,0 +1,87 @@ | |||
--- | |||
layout: "aws" | |||
page_title: "AWS: aws_rds_cluster" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws_rds_cluster_instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, thanks! Fixed in 249f5f7
I've successfully spun up a cluster and two instances with this PR, but I had trouble connecting to the cluster. I noticed that the issue is that there's no way to set "publicly accessible" to true (verified by manually spinning up a publicly accessible instance), so that's something that should be added to cluster instances (otherwise you can only access them in the VPC or through tunnels). I'd also recommend supporting some other
We're looking to play around some more with Aurora, so we're excited to see this one get merged. Thanks, @catsby! |
There are some typos in the documentation (identifer vs identifier). Also there is no "instance_identifier" variable (I believe it's just "identifier"?). |
@catsby - I've tested it and it works. Is it possible to set the parameter somehow "publicly_accessible"? Thanks |
@ravbaba, providing vpc_security_group_ids seems to turn off the publicly_accessible flag. |
@rosmo I've done it with |
dce1315
to
7c5f5de
Compare
I've added @phinze take a gander when you can |
_, err := conn.DeleteDBCluster(&rds.DeleteDBClusterInput{ | ||
DBClusterIdentifier: aws.String(d.Id()), | ||
SkipFinalSnapshot: aws.Bool(true), | ||
// final snapshot identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment a TODO?
@catsby a few minor inline notes. generally LGTM! 👍 |
41695bf
to
71b1cb1
Compare
provider/aws: RDS Cluster, Cluster Instance (Aurora)
@catsby this doesn't support cluster parameter groups, does it? |
@vjanelle sorry to say that no, those are not yet included. |
I needed `db_subnet_group_name` in the rds_cluster resource as well when creating on a non-default VPC. hashicorp#2935 (comment)
@catsby I wonder if parameter_group support for individual instances (not cluster parameter_group) is easier. Terraform's aws_db_instance allows you to specify parameter_group_name, but aws_rds_cluster_instance doesn't, aren't they the same old thing? Or is that also a completely different API? This alone would already be very helpful. |
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. |
Adds
RDS Cluster
andRDS Cluster Instance
resources (Amazon Aurora).Usage:
Scaling can be done with the
lifecycle
block:Noteworthy:
cluster
is it's own resource, and does not require any actual database instancescount
featureTODO: