Open OJFord opened 1 month ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @OJFord 👋 Thank you for taking the time to raise this! In this case, the provider is operating as expected. The schema for the resource matches the what is returned by the underlying SDK and API. For what it's worth, it also matches what's returned by the CLI command that's mentioned in the article that you linked.
You can access the value by using
aws_elasticache_serverless_cache.example.endpoint[0].address
With that in mind, I'm going to close this issue.
On a second read, I realize I've misread, and you already knew it was an object. Sorry about that! Reopening for further review with that in mind.
@justinretzolk it says they are 'structure' not list of structure? (Or in the API docs 'object', or in the SDK *Endpoint
not []Endpoint
)
(It does include reader_endpoint though you're right, is that only for when engine is memcached perhaps?)
Looks like we commented at the same time @OJFord 🙂. I'm not entirely certain I know the answers to your follow up questions on a quick look, so I'll leave that for someone from the team or community with a bit more context.
Found this while looking if there is an open issue for the missing data source for aws_elasticache_serverless_cache
, and it picked my interest.
Indeed the endpoint
, and reader_endpoint
* should be objects, and not a list of objects.
I dug through the commit history and found they are a list of objects since their initial implementation, which, according to the PR (https://github.com/hashicorp/terraform-provider-aws/pull/34951), was implemented by @meetreks and @johnsonaj, so I think they are best to chime in why that's a list and not an object.
* - reader_endpoint
is rightly part of the resource as it is part of the ServerlessCache object from AWS API, and AWS SDK for Go v2, see
There is an open issue for what I was actually looking for, sadly ignored for quite some time, https://github.com/hashicorp/terraform-provider-aws/issues/35469
reader_endpoint
is rightly part of the resource as it is part of the ServerlessCache object from AWS API, and AWS SDK for Go v2
Yeah, I'm not sure if it will have a value for redis (vs. memcached) caches though (if it does it would be the same as the endpoint
and not read-only) so probably worth documenting as for when engine = "memcached"
.
Yeah, I'm not sure if it will have a value for redis (vs. memcached) caches though (if it does it would be the same as the endpoint and not read-only) so probably worth documenting as for when engine = "memcached".
It does have a value for Redis caches, and it's not the same as the endpoint
one, the port is different.
Here's a snippet of the AWS CLI response of aws elasticache describe-serverless-caches --serverless-cache-name $cacheName
"Engine": "redis",
"Endpoint": {
"Address": "<redacted>.serverless.euw1.cache.amazonaws.com",
"Port": 6379
},
"ReaderEndpoint": {
"Address": "<redacted>.serverless.euw1.cache.amazonaws.com",
"Port": 6380
},
Terraform Core Version
1.9.5
AWS Provider Version
5.65.0
Affected Resource(s)
Expected Behavior
endpoint
should be a single objectreader_endpoint
should not existActual Behavior
endpoint
is a list of nested objectsreader_endpoint
is a list of nested objectsRelevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
terraform console
>aws_elasticache_serverless_cache.test.endpoint
Debug Output
No response
Panic Output
No response
Important Factoids
References
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_serverless_cache#endpoint
https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/GettingStarted.serverless.step2.html ('the Endpoint field')
Would you like to implement a fix?
None