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

New Data Source: aws_elasticache_replication_group #2124

Merged
merged 5 commits into from
Nov 10, 2017

Conversation

atsushi-ishibashi
Copy link
Contributor

@atsushi-ishibashi
Copy link
Contributor Author

make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsElasticacheReplicationGroup_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsElasticacheReplicationGroup_basic -timeout 120m
=== RUN   TestAccDataSourceAwsElasticacheReplicationGroup_basic
--- PASS: TestAccDataSourceAwsElasticacheReplicationGroup_basic (1280.84s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1280.907s
make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsElasticacheReplicationGroup_ClusterMode'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsElasticacheReplicationGroup_ClusterMode -timeout 120m
=== RUN   TestAccDataSourceAwsElasticacheReplicationGroup_ClusterMode
--- PASS: TestAccDataSourceAwsElasticacheReplicationGroup_ClusterMode (1377.07s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1377.147s

@atsushi-ishibashi atsushi-ishibashi changed the title [WIP]New Data Source: aws_elasticache_replication_group New Data Source: aws_elasticache_replication_group Nov 1, 2017
@Ninir Ninir added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 5, 2017
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks for this PR.
I left you some comments there - one important about the testing config, others less important.


resp, err := conn.DescribeReplicationGroups(input)
if err != nil {
return errwrap.Wrapf("Error retrieving Elasticache Replication Group: {{err}}", err)
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: The errwrap IMO isn't necessary in this context as there's no code that would need to know the original error above CRUD. Pretty much all errors from CRUD end up as messages printed in the CLI, so there's not much value in using this over simple fmt.Errorf().

}
}
if rg == nil {
return fmt.Errorf("[ERROR] Elasticache Replication Group (%s) not found", d.Get("replication_group_id").(string))
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: It's already clear that this is an error and it will be raised/displayed as such, there's no need to add an explicit [ERROR] here. It would be only valid in a log message.

} else {
if rg.NodeGroups == nil {
d.SetId("")
return fmt.Errorf("[ERROR] Elasticache Replication Group (%s) doesn't have node groups.", d.Get("replication_group_id").(string))
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: As above re [ERROR] ^

number_cache_clusters = 2
port = 6379
parameter_group_name = "default.redis3.2"
availability_zones = ["us-east-1a", "us-east-1b"]
Copy link
Member

Choose a reason for hiding this comment

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

This is currently failing in our AWS testing account:

=== RUN   TestAccDataSourceAwsElasticacheReplicationGroup_basic
--- FAIL: TestAccDataSourceAwsElasticacheReplicationGroup_basic (21.10s)
	testing.go:492: Step 0 error: Error applying: 1 error(s) occurred:

		* aws_elasticache_replication_group.bar: 1 error(s) occurred:

		* aws_elasticache_replication_group.bar: Error creating Elasticache Replication Group: InvalidParameterValue: us-east-1b is not a valid availability zone.
			status code: 400, request id: d01f865d-c572-11e7-8067-e323f32a1242

and it's usually not a good practice to hard-code AZs.

Can you please make it reusable by using the AZ data source here? https://www.terraform.io/docs/providers/aws/d/availability_zones.html

@radeksimko radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Nov 9, 2017
@atsushi-ishibashi
Copy link
Contributor Author

@radeksimko You're welcome to review👍

@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Nov 10, 2017
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@radeksimko radeksimko merged commit d503e89 into hashicorp:master Nov 10, 2017
@ghost
Copy link

ghost commented Apr 10, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants