Skip to content

Commit 3370eca

Browse files
author
Your Name
committed
Update exercise documentation for testing module with EC2 instances
1 parent b5e8ae0 commit 3370eca

File tree

6 files changed

+66
-65
lines changed

6 files changed

+66
-65
lines changed

KR_exercises/exercise43-testing_module.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Testing Our Module with EC2 Instances
1+
# EC2 인스턴스로 모듈 테스트
22

33
## Introduction
44

5-
In this exercise, we will be testing our module with Amazon EC2 instances. We will ensure that our networking module is functioning correctly, and then we will create a new EC2 instance inside one of our created subnets. This will help us understand how to integrate our module with other AWS services and verify its functionality.
5+
이 연습에서는 Amazon EC2 인스턴스로 모듈을 테스트해 보겠습니다. 네트워킹 모듈이 올바르게 작동하는지 확인한 다음 생성된 서브넷 중 하나에 새 EC2 인스턴스를 생성하겠습니다. 이를 통해 모듈을 다른 AWS 서비스와 통합하는 방법을 이해하고 기능을 검증하는 데 도움이 될 것입니다.
66

77
## Step-by-Step Guide
88

9-
1. Start by ensuring that the networking module is correctly working by running `terraform apply` and ensuring that all resources are created.
10-
2. Create a new EC2 instance using the Ubuntu AMI, and deploy this EC2 instance inside the `subnet_1` subnet that we have created with the module.
9+
1. 먼저 네트워킹 모듈이 올바르게 작동하는지 확인하기 위해 `terraform apply`를 실행하고 모든 리소스가 생성되었는지 확인합니다.
10+
2. Ubuntu AMI를 사용하여 새 EC2 인스턴스를 생성하고 이 EC2 인스턴스를 모듈로 생성한 `subnet_1` 서브넷 내에 배포합니다.
1111

1212
```
1313
locals {
@@ -31,7 +31,7 @@ In this exercise, we will be testing our module with Amazon EC2 instances. We wi
3131
3232
resource "aws_instance" "this" {
3333
ami = data.aws_ami.ubuntu.id
34-
instance_type = "t2.micro"
34+
instance_type = "t3.micro"
3535
subnet_id = module.vpc.private_subnets["subnet_1"].subnet_id
3636
3737
tags = {
@@ -41,10 +41,10 @@ In this exercise, we will be testing our module with Amazon EC2 instances. We wi
4141
}
4242
```
4343
44-
3. Make sure that everything is working by running `terraform apply` and inspecting the created infrastructure in the AWS console.
44+
3. `terraform apply`를 실행하고 AWS 콘솔에서 생성된 인프라를 검사하여 모든 것이 작동하는지 확인합니다.
4545
46-
4. Make sure to destroy the resources after you complete all the steps!
46+
4. 모든 단계를 완료한 후에는 리소스를 반드시 파기하세요!
4747
4848
## Congratulations on Completing the Exercise!
4949
50-
Great job on completing this exercise! You've successfully tested a module with Amazon EC2 instances and integrated it with other AWS services. This is a significant step in understanding how to work with Terraform and AWS. Keep up the good work!
50+
이 연습을 완료해 주셔서 감사합니다! Amazon EC2 인스턴스로 모듈을 성공적으로 테스트하고 다른 AWS 서비스와 통합했습니다. 이는 Terraform과 AWS로 작업하는 방법을 이해하는 데 있어 중요한 단계입니다. 계속 열심히 하세요!

KR_exercises/exercise44-preconditions.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
## Introduction
44

5-
In this exercise, you'll be working on creating Precondition Blocks in Terraform. This exercise aims to provide you with an understanding of how to implement rules that must be met before Terraform applies changes to your infrastructure. You'll configure a new Terraform project and create an EC2 instance with an Ubuntu AMI. Additionally, you'll add a precondition block to ensure the chosen instance type matches a list of allowed instance types.
5+
이 연습에서는 Terraform에서 Precondition(전제 조건) 블록을 만드는 작업을 하게 됩니다. 이 연습은 Terraform이 인프라에 변경 사항을 적용하기 전에 충족해야 하는 규칙을 구현하는 방법을 이해하는 것을 목표로 합니다. 새 Terraform 프로젝트를 구성하고 Ubuntu AMI로 EC2 인스턴스를 생성합니다. 또한 선택한 인스턴스 유형이 허용된 인스턴스 유형 목록과 일치하는지 확인하기 위해 Precondition(전제 조건) 블록을 추가합니다.
66

77
## Desired Outcome
88

9-
If you wish to give it a shot before looking into the detailed step-by-step and the solution videos, here is an overview of what the created solution should deploy:
9+
자세한 단계별 내용과 솔루션 동영상을 살펴보기 전에 한 번 사용해 보고 싶다면 생성된 솔루션이 배포해야 하는 내용을 간략하게 살펴보세요:
1010

11-
1. Create a new folder for this section.
12-
2. Deploy an EC2 instance with an Ubuntu AMI.
13-
3. Create a variable `instance_type` of type string and a default value of `t2.micro`.
14-
4. Create a new `allowed_instance_types` local, containing a list of allowed instance types for our EC2 instance.
15-
5. Define a precondition block in the created EC2 instance to ensure that the `instance_type` variable's value is in the `allowed_instance_types` local.
11+
1. 이 섹션을 위한 새 폴더를 만듭니다.
12+
2. 우분투 AMI로 EC2 인스턴스를 배포합니다.
13+
3. 문자열 타입의 `instance_type` 변수를 생성하고 기본값은 `t2.micro`로 설정합니다.
14+
4. EC2 인스턴스에 허용된 인스턴스 유형 목록이 포함된 새로운 `allowed_instance_types` 로컬을 생성합니다.
15+
5. 생성된 EC2 인스턴스에서 Precondition(전제 조건) 블록을 정의하여 `instance_type` 변수의 값이 `allowed_instance_types` 로컬에 있는지 확인합니다.
1616

1717
## Step-by-Step Guide
1818

19-
1. Create a new folder for a new Terraform project, and configure the required Terraform version and the AWS provider with the same versions as we have been using throughout the course.
20-
2. Create a new file named `compute.tf` file and create an EC2 instance with an Ubuntu AMI.
19+
1. 새 Terraform 프로젝트를 위한 새 폴더를 만들고, 필요한 Terraform 버전과 AWS 공급자를 이 과정 내내 사용했던 것과 동일한 버전으로 구성합니다.
20+
2. `compute.tf` 파일이라는 이름의 새 파일을 생성하고 Ubuntu AMI로 EC2 인스턴스를 생성합니다.
2121

2222
```
2323
data "aws_ami" "ubuntu" {
@@ -47,7 +47,7 @@ If you wish to give it a shot before looking into the detailed step-by-step and
4747
}
4848
```
4949
50-
3. Create a new `variables.tf` file and declare a new variable `instance_type` of type string and with a default value of `t2.micro`.
50+
3. `variables.tf` 파일을 만들고 문자열 유형이고 기본값이 `t2.micro`인 새 변수 `instance_type`을 선언합니다.
5151
5252
```
5353
variable "instance_type" {
@@ -56,15 +56,15 @@ If you wish to give it a shot before looking into the detailed step-by-step and
5656
}
5757
```
5858
59-
4. Create a new `allowed_instance_types` local in the `compute.tf` file, and define a list containing only the instance types that should be allowed for our EC2 instance.
59+
4. `compute.tf` 파일에 로컬에 `allowed_instance_types`를 새로 생성하고 EC2 인스턴스에 허용해야 하는 인스턴스 유형만 포함된 목록을 정의합니다.
6060
6161
```
6262
locals {
6363
allowed_instance_types = ["t2.micro", "t3.micro"]
6464
}
6565
```
6666
67-
5. Add a precondition block to check that the value received for the `instance_type` variable is contained in the `allowed_instance_types` local. Test your code by running `terraform plan` and confirming that no errors are present. Try to change the default value of the variable to an invalid value, and run `terraform plan` again. Which type of error do we get?
67+
5. Precondition(전제 조건) 블록을 추가하여 `instance_type` 변수에 대해 받은 값이 `allowed_instance_types` 로컬에 포함되어 있는지 확인합니다. `terraform plan`을 실행하여 코드를 테스트하고 오류가 없는지 확인합니다. 변수의 기본값을 잘못된 값으로 변경하고 `terraform plan`을 다시 실행해 보세요. 어떤 유형의 오류가 발생하나요?
6868
6969
```
7070
resource "aws_instance" "this" {
@@ -89,4 +89,4 @@ If you wish to give it a shot before looking into the detailed step-by-step and
8989
9090
## Congratulations on Completing the Exercise!
9191
92-
Congratulations on successfully completing this exercise on creating Precondition Blocks in Terraform! You've taken an important step in understanding how to implement rules that must be met before Terraform applies changes to your infrastructure. Keep up the good work!
92+
Terraform에서 전제 조건 블록 생성 연습을 성공적으로 완료하신 것을 축하드립니다! 테라폼이 인프라에 변경 사항을 적용하기 전에 충족해야 하는 규칙을 구현하는 방법을 이해하는 데 중요한 단계를 밟으셨습니다. 계속 열심히 하세요!

KR_exercises/exercise45-postconditions.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
## Introduction
44

5-
In this exercise, you will learn how to replace a precondition block with a postcondition block that references the `self.instance_type` property of the EC2 instance. You will also create a second postcondition block intended to fail, create a new subnet within the default VPC, and add a `create_before_destroy = true` lifecycle property to the `aws_instance`. Finally, you will update the postcondition check to ensure that the subnet’s availability zone is contained in the list of valid availability zone names. This exercise will help you understand how to use postcondition blocks effectively in Terraform.
5+
이 연습에서는 precondition(사전 조건) 블록을 EC2 인스턴스의 `self.instance_type` 속성을 참조하는 Postcondition(사후 조건) 블록으로 대체하는 방법을 배웁니다. 또한 실패하도록 의도된 두 번째 Postcondition(사후 조건) 블록을 생성하고, 기본 VPC 내에 새 서브넷을 생성하고, `aws_instance``create_before_destroy = true` 수명 주기 속성을 추가합니다. 마지막으로 Postcondition을 업데이트하여 서브넷의 가용 영역이 유효한 가용 영역 이름 목록에 포함되어 있는지 확인합니다. 이 실습을 통해 Terraform에서 Postcondition 블록을 효과적으로 사용하는 방법을 이해하는 데 도움이 될 것입니다.
66

77
## Desired Outcome
88

9-
If you wish to give it a shot before looking into the detailed step-by-step and the solution videos, here is an overview of what the created solution should deploy:
9+
자세한 단계별 내용과 솔루션 동영상을 살펴보기 전에 한 번 사용해 보고 싶다면 생성된 솔루션이 배포해야 하는 내용을 간략하게 살펴보세요:
1010

11-
1. Replace the precondition block with a postcondition block that references the `self.instance_type` property of the EC2 instance instead of the provided variable.
12-
2. Create a new subnet within the default VPC and with a CIDR block set to `172.31.128.0/24`.
13-
3. Add a `create_before_destroy = true` lifecycle property to the `aws_instance`.
14-
4. Update the postcondition check to ensure that the subnet’s availability zone is contained in the list of valid availability zone names.
15-
5. Make sure that everything is working by running `terraform apply` and confirming that the operations successfully complete.
11+
1. precondition(사전 조건) 블록을 제공된 변수 대신 EC2 인스턴스의 `self.instance_type` 속성을 참조하는 Postcondition(사후 조건) 블록으로 바꿉니다.
12+
2. 기본 VPC 내에 새 서브넷을 생성하고 CIDR 블록을 `172.31.128.0/24`로 설정합니다.
13+
3. `aws_instance`에 lifecycle 속성으로 `create_before_destroy = true`을 추가합니다.
14+
4. Postcondition을 업데이트하여 서브넷의 가용 영역이 유효한 가용 영역 이름 목록에 포함되어 있는지 확인합니다.
15+
5. `terraform apply`를 실행하고 작업이 성공적으로 완료되었는지 확인하여 모든 것이 작동하는지 확인합니다.
1616

1717
## Step-by-Step Guide
1818

19-
1. Make sure that the EC2 instance is not created. If you created it in the previous exercise, make sure to delete it. Remove the precondition block we created in the previous lecture, and replace it with a postcondition block that references the `self.instance_type` property of the EC2 instance.
19+
1. EC2 인스턴스가 생성되지 않았는지 확인합니다. 이전 연습에서 생성했다면 반드시 삭제하세요. 이전 강의에서 생성한 precondition 블록을 제거하고 EC2 인스턴스의 `self.instance_type` 속성을 참조하는 Postcondition 블록으로 대체합니다.
2020

2121
```
2222
resource "aws_instance" "this" {
@@ -38,7 +38,7 @@ If you wish to give it a shot before looking into the detailed step-by-step and
3838
}
3939
```
4040
41-
2. Add a second postcondition block with the condition set to `self.availability_zone == "eu-central-1a"`. If you are using the `eu-central-1` region, use another value for the availability zone. This is on purpose, as this postcondition block should fail. Run a `terraform plan` and inspect whether there are any errors. Why were there no errors? Now run the `terraform apply` command and confirm the operation. What happened?
41+
2. 조건이 `self.availability_zone == "eu-central-1a"`로 설정된 두 번째 Postcondition 블록을 추가합니다. `eu-central-1` 지역을 사용하는 경우 가용성 영역에 다른 값을 사용하세요. 이 Postcondition 블록은 실패해야 하므로 의도적으로 설정한 것입니다. `terraform plan`을 실행하고 오류가 있는지 검사합니다. 오류가 없는 이유는 무엇인가요? 이제 `terraform apply` 명령을 실행하고 작동을 확인합니다. 무슨 일이 일어났나요?
4242
4343
```
4444
resource "aws_instance" "this" {
@@ -52,6 +52,7 @@ If you wish to give it a shot before looking into the detailed step-by-step and
5252
}
5353
5454
lifecycle {
55+
# create_before_destroy = true
5556
postcondition {
5657
condition = contains(local.allowed_instance_types, self.instance_type)
5758
error_message = "Self invalid instance type"
@@ -60,15 +61,15 @@ If you wish to give it a shot before looking into the detailed step-by-step and
6061
}
6162
```
6263
63-
3. Fetch the default VPC for the configured region by using an `aws_vpc` data source.
64+
3. `aw_vpc` 데이터 소스를 사용하여 구성된 지역에 대한 기본 VPC를 가져옵니다.
6465
6566
```
6667
data "aws_vpc" "default" {
6768
default = true
6869
}
6970
```
7071
71-
4. Create a new subnet using the VPC data we have fetched. Set the CIDR block to `172.31.128.0/24`. Additionally, move the postcondition check that contains the availability zone check to this newly created subnet, and explicitly set the `subnet_id` in the `aws_instance` resource to reference this newly created subnet.
72+
4. 가져온 VPC 데이터를 사용하여 새 서브넷을 생성합니다. CIDR 블록을 `172.31.128.0/24`로 설정합니다. 또한 가용성 영역 검사가 포함된 Postcondition 검사를 새로 생성된 이 서브넷으로 이동하고, 새로 생성된 이 서브넷을 참조하도록 `aws_instance` 리소스에서 `subnet_id`를 명시적으로 설정합니다.
7273
7374
```
7475
resource "aws_subnet" "this" {
@@ -84,8 +85,8 @@ If you wish to give it a shot before looking into the detailed step-by-step and
8485
}
8586
```
8687
87-
5. Add a `create_before_destroy = true` lifecycle property to the `aws_instance` we have created. This will make sure that new instances are created before old ones are destroyed. Run `terraform apply`, approve the changes, and inspect what will happen in the console. Which resources were created? Where did Terraform stop?
88-
6. Now update the postcondition check to be more realistic and check whether the subnet’s availability zone is contained in the list of valid availability zone names that can be fetched via the `aws_availability_zones` data source.
88+
5. 생성한 `aws_instance`에 lifecycle 속성으로 `create_before_destroy = true` 를 추가합니다. 이렇게 하면 이전 인스턴스가 삭제되기 전에 새 인스턴스가 생성됩니다. `terraform apply`를 실행하고 변경 사항을 승인한 다음 콘솔에서 어떤 일이 발생하는지 확인합니다. 어떤 리소스가 생성되었나요? 테라폼이 어디에서 멈췄나요?
89+
6. 이제 postcondition 검사를 보다 현실적으로 업데이트하고 서브넷의 가용성 영역이 `aws_availability_zones` 데이터 소스를 통해 가져올 수 있는 유효한 가용성 영역 이름 목록에 포함되어 있는지 확인합니다.
8990
9091
```
9192
data "aws_availability_zones" "available" {
@@ -105,9 +106,9 @@ If you wish to give it a shot before looking into the detailed step-by-step and
105106
}
106107
```
107108
108-
7. Run `terraform apply` and confirm that the command goes through without any errors.
109-
8. Make sure to destroy the infrastructure at the end of this exercise.
109+
7. `terraform apply`을 실행하고 명령이 오류 없이 실행되는지 확인합니다.
110+
8. 이 연습이 끝나면 인프라를 파괴하세요.
110111
111112
## Congratulations on Completing the Exercise!
112113
113-
Well done on completing this exercise! You've made great strides in understanding how to effectively use postcondition blocks in Terraform. Keep up the good work!
114+
이 연습을 잘 마쳤습니다! 테라폼에서 postcondition 블록을 효과적으로 사용하는 방법을 이해하는 데 큰 진전을 이루었습니다. 앞으로도 계속 노력하세요!

0 commit comments

Comments
 (0)