Reputation: 1179
I'm doing whatever I can to create a Redis serverless cluster on AWS using Terraform, but prefer the easiest, closest to out of the box Terraform. But I'm not understanding the error reported by Terraform.
I tried... I can get traditional 7.1 cluster on AWS, but I can't get a serverless version. I tried building my own version https://hashicorp.github.io/terraform-provider-aws/development-environment/. The docs suggested there is this aws_elasticache_serverless_cache resource, but when I do an apply, it never finds it. I'm using Terraform version 1.6.6 on linux_amd64.
So, do get around the difficulty of using a custom provider, I cloned https://github.com/SPHTech-Platform/terraform-aws-elasticache-redis and set variables
enabled = true
create_elasticache_subnet_group = true
use_serverless = true
subnets = ["subnet-dce5d0bb"]
and I added to main.tf
provider "aws" {
region = "us-west-2"
}
provider "awscc" {
region = "us-west-2"
}
and I get this error:
awscc_elasticache_serverless_cache.this[0]: Creating...
Warning: AWS Resource Not Found During Refresh
with awscc_elasticache_serverless_cache.this[0],
on main.tf line 86, in resource "awscc_elasticache_serverless_cache" "this":
86: resource "awscc_elasticache_serverless_cache" "this" {
Automatically removing from Terraform State instead of returning the error, which may trigger resource recreation. Original Error: couldn't find resource
Error: AWS SDK Go Service Operation Incomplete
with awscc_elasticache_serverless_cache.this[0],
on main.tf line 86, in resource "awscc_elasticache_serverless_cache" "this":
86: resource "awscc_elasticache_serverless_cache" "this" {
Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to FAILED. StatusMessage:
Serverless Cache should have total subnetIds between 2 and 3. (Service: ElastiCache, Status Code: 400, Request ID:
9f252b92-e7cb-4f9f-a143-12d841713ade). ErrorCode: InvalidRequest
I verified the subnet exists in my VPC on my account on us-west-2.
Please help me understand my error.
Upvotes: 0
Views: 991
Reputation: 18203
The important part of the error output is this:
Serverless Cache should have total subnetIds between 2 and 3.
If we take a look at the values you are providing, we can see that you have defined only one subnet:
subnets = ["subnet-dce5d0bb"]
Based on the error, you need minimum two and maximum three subnets. Additionally, the aws_elasticache_serverless_cache
is available in the latest provider verison.
Upvotes: 1