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

provider/aws: Add Primary Endpoint Address attribute for aws_elasticache_replication_group #8385

Merged
merged 1 commit into from
Aug 23, 2016

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Aug 22, 2016

Fixes #8377

Now we can output the endpoint of the primary

resource "aws_elasticache_replication_group" "bar" {
    replication_group_id = "tf-11111"
    replication_group_description = "test description"
    node_type = "cache.m1.small"
    number_cache_clusters = 2
    port = 6379
    parameter_group_name = "default.redis2.8"
    apply_immediately = true
}

output "primary_endpoint_address" {
  value = "${aws_elasticache_replication_group.bar.primary_endpoint_address}"
}

This gives us:

% terraform apply
...................
aws_elasticache_replication_group.bar: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

primary_endpoint_address = tf-11111.d5jx4z.ng.0001.use1.cache.amazonaws.com

This was the addition of a computed field only so the basic test still works as expected:

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheReplicationGroup_basic'                        ✹
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/22 17:11:13 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheReplicationGroup_basic -timeout 120m
=== RUN   TestAccAWSElasticacheReplicationGroup_basic
--- PASS: TestAccAWSElasticacheReplicationGroup_basic (741.71s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    741.735s

`aws_elasticache_replication_group`

Fixes #8377

Now we can output the endpoint of the primary

```
resource "aws_elasticache_replication_group" "bar" {
    replication_group_id = "tf-11111"
    replication_group_description = "test description"
    node_type = "cache.m1.small"
    number_cache_clusters = 2
    port = 6379
    parameter_group_name = "default.redis2.8"
    apply_immediately = true
}

output "primary_endpoint_address" {
  value = "${aws_elasticache_replication_group.bar.primary_endpoint_address}"
}
```

This gives us:

```
% terraform apply
...................
aws_elasticache_replication_group.bar: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

primary_endpoint_address = tf-11111.d5jx4z.ng.0001.use1.cache.amazonaws.com
```

This was the addition of a computed field only so the basic test still works as expected:

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheReplicationGroup_basic'                        ✹
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/22 17:11:13 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheReplicationGroup_basic -timeout 120m
=== RUN   TestAccAWSElasticacheReplicationGroup_basic
--- PASS: TestAccAWSElasticacheReplicationGroup_basic (741.71s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	741.735s
```
@jen20 jen20 changed the title provider/aws: Add Primary Endpoint Address output for aws_elasticache_replication_group provider/aws: Add Primary Endpoint Address attribute for aws_elasticache_replication_group Aug 23, 2016
@@ -215,6 +220,8 @@ func resourceAwsElasticacheReplicationGroupRead(d *schema.ResourceData, meta int
d.Set("snapshot_window", c.SnapshotWindow)
d.Set("snapshot_retention_limit", c.SnapshotRetentionLimit)

d.Set("primary_endpoint_address", rgp.NodeGroups[0].PrimaryEndpoint.Address)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any possibility of this being empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As long as we have gotten into this block, we have passed a check to make sure that there is a NodeGroup available :) The first NodeGroup is the primary and we use that to populate all of the information above it

Choose a reason for hiding this comment

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

@stack72 @jen20 -How to get addresses for replica nodes?

@jen20
Copy link
Contributor

jen20 commented Aug 23, 2016

One question, otherwise LGTM

@stack72 stack72 merged commit 83dc4d0 into master Aug 23, 2016
@stack72 stack72 deleted the aws-elasticache-rg-primary-endpoint-2 branch August 23, 2016 10:13
c4milo added a commit to hooklift/terraform that referenced this pull request Aug 23, 2016
* master: (100 commits)
  Update CHANGELOG.md
  providers/aws: Check error from resourceAwsRoute53RecordBuildSet and return err if set (hashicorp#8399)
  Update CHANGELOG.md
  provider/aws: Add support for ECS svc - LB target group (hashicorp#8190)
  Added example of how the Option settings works (hashicorp#8413)
  Update CHANGELOG.md
  Update CHANGELOG.md
  Update CHANGELOG.md
  provider/aws: Add support for `network_mode` to `aws_ecs_task_definition` (hashicorp#8391)
  Update CHANGELOG.md
  Update CHANGELOG.md
  provider/aws: Add Primary Endpoint Address output for (hashicorp#8385)
  Update CHANGELOG.md
  provider/aws: `aws_elasticache_replication_group_id` validation change (hashicorp#8381)
  provider/google: Remove redundant type declaration
  provider/google: Hook in state migration function
  provider/openstack: docs and tests for allowed_address_pairs
  Update CHANGELOG.md
  website: Docs for AWS API Gateway domain name and base path mapping
  provider/aws: aws_api_gateway_base_path_mapping resource implementation
  ...
@manuchadha
Copy link

@stack72 @jen20 -How to get addresses for replica nodes?

@jen20
Copy link
Contributor

jen20 commented Jul 31, 2018

Presumably there is a secondary endpoint on the structure which you could expose. Development now goes on in the AWS provider repo, which is the appropriate place to log an issue (after searching for an existing one) for this.

@ghost
Copy link

ghost commented Apr 2, 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 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resource AWS_ELASTICACHE_REPLICATION_GROUP should at least output the primary endpoint address and its portt
3 participants