Hi Lou! Great post - I really liked how you broke down each step so clearly.
The only thing I didn't understand was this part: Once you’ve got your bucket, substitute the bucket name into the YOUR_REMOTE_STATE_BUCKET_NAME and the YOUR_REMOTE_STATE_KEY with the name of your (soon to be created S3 bucket) i.e my_lovely_new_website.
So basically, YOUR_REMOTE_STATE_BUCKET_NAME refers to the bucket you manually create in your AWS account, and YOUR_REMOTE_STATE_KEY refers to the one you're about to set up with Terraform? I guess (from the perspective of someone who is completely new to Terraform), why do you need to set YOUR_REMOTE_STATE_KEY if you already have YOUR_REMOTE_STATE_BUCKET_NAME?
Re-thinking developer experience • Product @Gitpod 🍊 Helping folks get their start in cloud • @openupthecloud ☁️ AWS Community Builder 🛠 Replies in GIFS 😃
Ah yeah that part is confusing. I think I was answering it when I said:
*Note: * That the key in this context references the name of the state of the current provisioned resources, as a single backend state can hold data about many different terraform configurations.
But let me rephrase if that helps you understand it better...
Let's talk about remote state for a second. A large corporation could decide to have only one remote state bucket and re-use it across all teams (because they can). But they wouldn't want to all share the same remote state file. To get around this each project has a "key" which distinguishes that projects specific remote state from another.
In reality the remote state bucket has a structure like this:
Where the parent directory is your S3 and the child files are the state files (named according to your key). It's probably easier to see it in real life. So here's two screenshots of my own setup.
Example S3 (With a remote state bucket)
You can see I currently have three buckets setup. One is remote state, the other two are regular "resources".
The name of the state bucket is the: YOUR_REMOTE_STATE_BUCKET_NAME
Example S3 Remote State Bucket
And inside the remote state I have three projects, these are your keys.
The name of these files is the: YOUR_REMOTE_STATE_KEY
So when you're setting up Terraform remote sate you'll need:
A remote state bucket which you can create manually (Note: there are ways to script the creation of the remote state bucket itself but it gets a bit confusing as you have to create the bucket and then import it back into Terraform)
A key (which is usually just the name of the project)
Does that help?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Lou! Great post - I really liked how you broke down each step so clearly.
The only thing I didn't understand was this part: Once you’ve got your bucket, substitute the bucket name into the
YOUR_REMOTE_STATE_BUCKET_NAME
and theYOUR_REMOTE_STATE_KEY
with the name of your (soon to be created S3 bucket) i.emy_lovely_new_website
.So basically,
YOUR_REMOTE_STATE_BUCKET_NAME
refers to the bucket you manually create in your AWS account, andYOUR_REMOTE_STATE_KEY
refers to the one you're about to set up with Terraform? I guess (from the perspective of someone who is completely new to Terraform), why do you need to setYOUR_REMOTE_STATE_KEY
if you already haveYOUR_REMOTE_STATE_BUCKET_NAME
?Hey Aishwarya! :)
Ah yeah that part is confusing. I think I was answering it when I said:
But let me rephrase if that helps you understand it better...
Let's talk about remote state for a second. A large corporation could decide to have only one remote state bucket and re-use it across all teams (because they can). But they wouldn't want to all share the same remote state file. To get around this each project has a "key" which distinguishes that projects specific remote state from another.
In reality the remote state bucket has a structure like this:
Where the parent directory is your S3 and the child files are the state files (named according to your key). It's probably easier to see it in real life. So here's two screenshots of my own setup.
Example S3 (With a remote state bucket)
You can see I currently have three buckets setup. One is remote state, the other two are regular "resources".
The name of the state bucket is the:
YOUR_REMOTE_STATE_BUCKET_NAME
Example S3 Remote State Bucket
And inside the remote state I have three projects, these are your keys.
The name of these files is the:
YOUR_REMOTE_STATE_KEY
So when you're setting up Terraform remote sate you'll need:
Does that help?