hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

[Bug]: open aws_elasticache_serverless_cache unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>) #35896

Closed zenzedoon closed 7 months ago

zenzedoon commented 8 months ago

Terraform Core Version

1.4.6

AWS Provider Version

4.0

Affected Resource(s)

aws_elasticache_serverless_cache

Expected Behavior

Create an aws elasticache serverless ressource

Actual Behavior

Error: waiting for creation Amazon ElastiCache Serverless Cache (pabdpspd00009): unexpected state 'create-failed', wanted target 'available'. last error: %!s()

Relevant Error/Panic Output Snippet

module.elcachesrverless.aws_elasticache_serverless_cache.redis_serverless[0]: Still creating... [1m0s elapsed]
2024-02-20T15:42:13.387Z [DEBUG] provider.terraform-provider-aws_v5.37.0_x5: HTTP Request Sent: http.method=POST http.request.header.amz_sdk_request="attempt=1; max=25" http.request.header.content_type=application/x-www-form-urlencoded http.request.header.x_amz_security_token=***** tf_rpc=ApplyResourceChange http.request.header.x_amz_date=20240220T154213Z http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.4.6 (+https://www.terraform.io) terraform-provider-aws/5.37.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go-v2/1.25.0 os/linux lang/go#1.21.7 md/GOOS#linux md/GOARCH#amd64 api/elasticache#1.35.0" tf_aws.sdk=aws-sdk-go-v2 tf_mux_provider=*proto5server.Server rpc.service=ElastiCache tf_req_id=cd2d4931-d3a8-fa2e-13e4-d55812234154076 net.peer.name=elasticache.eu-west-3.amazonaws.com rpc.method=DescribeServerlessCaches http.request.header.amz_sdk_invocation_id=df3af1c4-76ce-4fb9-9a5e-cead6d9e9b92 http.request_content_length=84 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_elasticache_serverless_cache @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.47/logging/tf_logger.go:45 http.request.body="Action=DescribeServerlessCaches&ServerlessCacheName=elasitccacheserverless&Version=2015-02-02
" http.url=https://elasticache.eu-west-3.amazonaws.com/ rpc.system=aws-api tf_aws.signing_region= http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************ENO7/20240220/eu-west-3/elasticache/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" @module=aws aws.region=eu-west-3 timestamp=2024-02-20T15:42:13.387Z
2024-02-20T15:42:13.529Z [DEBUG] provider.terraform-provider-aws_v5.37.0_x5: HTTP Response Received: http.response.body="<DescribeServerlessCachesResponse xmlns="http://elasticache.amazonaws.com/doc/2015-02-02/">
  <DescribeServerlessCachesResult>
    <ServerlessCaches>
      <member>
        <CacheUsageLimits>
          <ECPUPerSecond>
            <Maximum>1000</Maximum>
          </ECPUPerSecond>
          <DataStorage>
            <Unit>GB</Unit>
            <Maximum>10</Maximum>
          </DataStorage>
        </CacheUsageLimits>
        <MajorEngineVersion>7</MajorEngineVersion>
        <ServerlessCacheName>elasitccacheserverless</ServerlessCacheName>
        <DailySnapshotTime>21:00</DailySnapshotTime>
        <FullEngineVersion>7.1</FullEngineVersion>
        <Description>Elasticache Serverless for Redis elasitccacheserverless</Description>
        <SnapshotRetentionLimit>7</SnapshotRetentionLimit>
        <Engine>redis</Engine>
        <CreateTime>2024-02-20T15:41:12.824Z</CreateTime>
        <SecurityGroupIds>
          <SecurityGroupId>sg-123456789100</SecurityGroupId>
          <SecurityGroupId>sg-123456789101</SecurityGroupId>
          <SecurityGroupId>sg-123456789102</SecurityGroupId>
        </SecurityGroupIds>
        <ARN>arn:aws:elasticache:eu-west-3:XXXXXXXXXX:serverlesscache:elasitccacheserverless</ARN>
        <Status>create-failed</Status>
        <SubnetIds>
          <SubnetId>subnet-123456789100</SubnetId>
          <SubnetId>subnet-123456789101</SubnetId>
          <SubnetId>subnet-123456789102</SubnetId>
        </SubnetIds>
      </member>
    </ServerlessCaches>
  </DescribeServerlessCachesResult>
  <ResponseMetadata>
    <RequestId>d6acf8f4-2815-49c4-b019-5720153673</RequestId>
  </ResponseMetadata>
</DescribeServerlessCachesResponse>
" rpc.service=ElastiCache tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange @module=aws http.response.header.date="Tue, 20 Feb 2024 15:42:13 GMT" tf_resource_type=aws_elasticache_serverless_cache http.response.header.content_type=text/xml http.response.header.x_amzn_requestid=2015aa-2815-49c4-b019-123456reff http.status_code=200 tf_aws.signing_region= tf_mux_provider=*proto5server.Server tf_req_id=20153a-d3a8-fa2e-13e4-d55856d54076 @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.47/logging/tf_logger.go:45 aws.region=eu-west-3 http.duration=141 http.response_content_length=1682 rpc.method=DescribeServerlessCaches rpc.system=aws-api tf_aws.sdk=aws-sdk-go-v2 timestamp=2024-02-20T15:42:13.529Z
2024-02-20T15:42:13.530Z [ERROR] provider.terraform-provider-aws_v5.37.0_x5: Response contains error diagnostic: tf_resource_type=aws_elasticache_serverless_cache tf_rpc=ApplyResourceChange @module=sdk.proto diagnostic_detail="unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>)" tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/diag/diagnostics.go:62 diagnostic_severity=ERROR diagnostic_summary="waiting for creation Amazon ElastiCache Serverless Cache (elasitccacheserverless): unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>)" tf_proto_version=5.4 tf_req_id=cd2d4931-d3a8-fa2e-13e4-d55856d54076 timestamp=2024-02-20T15:42:13.530Z
2024-02-20T15:42:13.537Z [ERROR] vertex "module.elcachesrverless.aws_elasticache_serverless_cache.redis_serverless[0]" error: waiting for creation Amazon ElastiCache Serverless Cache (elasitccacheserverless): unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>)
╷
│ Error: waiting for creation Amazon ElastiCache Serverless Cache (elasitccacheserverless): unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>)
│ 
│   with module.elcachesrverless.aws_elasticache_serverless_cache.redis_serverless[0],
│   on ../main.tf line 164, in resource "aws_elasticache_serverless_cache" "redis_serverless":
│  164: resource "aws_elasticache_serverless_cache" "redis_serverless" {
│ 
│ unexpected state 'create-failed', wanted target 'available'. last error: %!s(<nil>)
╵
2024-02-20T15:42:13.542Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-02-20T15:42:13.543Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/fmontezuma/restapi/1.14.1/linux_amd64/terraform-provider-restapi_v1.14.1 pid=48773
2024-02-20T15:42:13.543Z [DEBUG] provider: plugin exited
2024-02-20T15:42:13.559Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/5.37.0/linux_amd64/terraform-provider-aws_v5.37.0_x5 pid=48783
2024-02-20T15:42:13.559Z [DEBUG] provider: plugin exiteda

Terraform Configuration Files

resource "aws_elasticache_serverless_cache" "redis_serverless" { engine = "redis" name = "elasticache01" cache_usage_limits { data_storage { maximum = 10 unit = "GB" } ecpu_per_second { maximum = 0 } } daily_snapshot_time = "09:00" description = "Elasticache Serverless for Redis" major_engine_version = "7" snapshot_retention_limit = 7 security_group_ids = var.elasticache_sg subnet_ids = var.subnet_id

) }

Steps to Reproduce

terraform plan terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 8 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

zenzedoon commented 8 months ago

after some reserach i found that the user that runs the terraform code dosen't have the permission to create a VPC endpoint. i search for another alternative but i can't find how to link an existing endpoint to the new elasticache serverless.

github-actions[bot] commented 6 months ago

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.