PhVHoang / TIL

10 stars 0 forks source link

Terraform state management on AWS #404

Open PhVHoang opened 1 year ago

PhVHoang commented 1 year ago

Common errors:

1. Initialization errors
Bucket doesn’t exist:  Users must ensure the S3 bucket exists prior to running terraform init.

Access denied related errors:  Your session may have expired, or the credentials you are using may not have enough privileges to access the S3 bucket.

2. State locking errors
LockID mismatch:  If a process or user holds a lock, Terraform operations will fail until the lock is released. This prevents simultaneous changes to the infrastructure

DynamoDB table configuration:  There may be issues with the Dynamo DB table configuration or with the credentials used to access it

3. Backend configuration errors
Invalid configuration data: There may be problems with one of the configurable parameters in the backend configuration (key, region, bucket_name, etc.).

4. Encryption errors
If you are using KMS and you have specified a custom KMS key, ensure your AWS credentials have enough permissions to use it.

5. Networking errors
Ensure the place from which you run your Terraform configuration has access to the S3 bucket or DynamoDB table.

6. S3 bucket policy issues
There may be policies in place that restrict certain IPs from accessing the bucket. Ensure you have enough permissions to access the S3 bucket.

References

https://spacelift.io/blog/terraform-s3-backend