Rename exercises dir

Name it instead "topics" so it won't be
strange if some topics included "exercises" directory.
This commit is contained in:
abregman
2022-08-02 01:51:39 +03:00
parent ea1d94d67b
commit 99c4e02ecf
235 changed files with 283 additions and 74 deletions

View File

@@ -0,0 +1,20 @@
# Rename S3 Bucket
## Requirements
* An existing S3 bucket tracked by Terraform.
If you don't have it, you can use the following block and run `terraform apply`:
```terraform
resource "aws_s3_bucket" "some_bucket" {
bucket = "some-old-bucket"
}
```
## Objectives
1. Rename an existing S3 bucket and make sure it's still tracked by Terraform
## Solution
Click [here to view the solution](solution.md)

View File

@@ -0,0 +1,49 @@
# Rename S3 Bucket
## Requirements
* An existing S3 bucket tracked by Terraform.
If you don't have it, you can use the following block and run `terraform apply`:
```terraform
resource "aws_s3_bucket" "some_bucket" {
bucket = "some-old-bucket"
}
```
## Objectives
1. Rename an existing S3 bucket and make sure it's still tracked by Terraform
## Solution
```sh
# A bucket name is immutable in AWS so we'll have to create a new bucket
aws s3 mb s3://some-new-bucket-123
# Sync old bucket to new bucket
aws s3 sync s3://some-old-bucket s3://some-new-bucket-123
# Remove the old bucket from Terraform's state
terraform state rm aws_s3_bucket.some_bucket
# Import new bucket to Terraform's state
terraform import aws_s3_bucket.some_bucket some-new-bucket-123
: '
aws_s3_bucket.some_bucket: Refreshing state... [id=some-new-bucket-123]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
'
# Modify the Terraform definition to include the new name
# resource "aws_s3_bucket" "some_bucket" {
# bucket = "some-new-bucket-123"
# }
# Remove old bucket
aws s3 rm s3://some-old-bucket --recursive
aws s3 rb s3://some-old-bucket
```