terraform
network_error
ai_generated
partial
Error: Error acquiring the state lock: RequestError: send request failed caused by: Post "https://s3.us-east-1.amazonaws.com/my-bucket/terraform.tfstate": dial tcp 52.95.139.7:443: i/o timeout
ID: terraform/state-lock-s3-request-timeout
80%Fix Rate
85%Confidence
1Evidence
2023-11-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Terraform v1.5 | active | — | — | — |
| Terraform v1.6 | active | — | — | — |
| Terraform v1.7 | active | — | — | — |
| AWS Provider v5.0+ | active | — | — | — |
Root Cause
Network connectivity issues prevent Terraform from reaching the S3 bucket used for state locking, typically due to firewall rules, VPN issues, or transient AWS outages.
generic中文
网络连接问题导致 Terraform 无法访问用于状态锁定的 S3 存储桶,通常由防火墙规则、VPN 问题或 AWS 临时中断引起。
Official Documentation
https://developer.hashicorp.com/terraform/language/settings/backends/s3Workarounds
-
85% success Check network connectivity to S3 endpoint: run 'curl -v https://my-bucket.s3.us-east-1.amazonaws.com' to verify reachability. If blocked, add firewall rule to allow outbound HTTPS to S3 IP ranges. Then retry 'terraform apply'.
Check network connectivity to S3 endpoint: run 'curl -v https://my-bucket.s3.us-east-1.amazonaws.com' to verify reachability. If blocked, add firewall rule to allow outbound HTTPS to S3 IP ranges. Then retry 'terraform apply'.
-
75% success If behind a proxy, set HTTP_PROXY and HTTPS_PROXY environment variables: 'export HTTPS_PROXY=http://proxy.company.com:8080' and run 'terraform init' again.
If behind a proxy, set HTTP_PROXY and HTTPS_PROXY environment variables: 'export HTTPS_PROXY=http://proxy.company.com:8080' and run 'terraform init' again.
中文步骤
Check network connectivity to S3 endpoint: run 'curl -v https://my-bucket.s3.us-east-1.amazonaws.com' to verify reachability. If blocked, add firewall rule to allow outbound HTTPS to S3 IP ranges. Then retry 'terraform apply'.
If behind a proxy, set HTTP_PROXY and HTTPS_PROXY environment variables: 'export HTTPS_PROXY=http://proxy.company.com:8080' and run 'terraform init' again.
Dead Ends
Common approaches that don't work:
-
95% fail
The error is a network timeout, not a stale lock. force-unlock doesn't fix connectivity and may cause state corruption if the lock is still held by another process.
-
80% fail
The timeout is at the TCP level, not the S3 API level. TCP dial timeout is controlled by OS network stack, not AWS CLI settings.
-
60% fail
This bypasses the lock but risks concurrent state modifications, leading to state corruption or lost updates.