I'm just starting to work with terraform and would like to use AWS S3 as a backend to store the status of my projects.
terraform {
backend "s3" {
bucket = "tfstate"
key = "app-state"
region = "us-east-1"
}
}
I feel it makes sense to configure my S3 bucket, IAM groups, and policies for the internal storage infrastructure using terraform.
If I configure my backend state before I apply my initial terraform infrastructure, he reasonably complains that the backend container has not yet been created. So, I have a question, how can I configure my internal terraform server using terraform while maintaining my state for the internal server monitored by terraform. It seems to be a problem with nesting dolls.
I have some thoughts on how to write a script around this, for example, check if a recycle bin or some state exists, then download terraform and finally copy terraform tfstate to s3 from the local file system after the first run. But before embarking on this time-consuming path, I thought that I had to make sure that I did not miss something obvious
source
share