docs: add Terraform certification notes and tasks
This commit is contained in:
53
terraform/007/main.tf
Normal file
53
terraform/007/main.tf
Normal file
@@ -0,0 +1,53 @@
|
||||
# terraform {
|
||||
# required_providers {
|
||||
# aws = {
|
||||
# source = "hashicorp/aws"
|
||||
# version = "~> 6.0"
|
||||
# }
|
||||
# tls = {
|
||||
# source = "hashicorp/tls"
|
||||
# version = "~> 4.0"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
|
||||
# provider "aws" {
|
||||
# region = "us-east-1"
|
||||
# }
|
||||
|
||||
# --- New RSA key pair ---
|
||||
resource "tls_private_key" "devops_kp" {
|
||||
algorithm = "RSA"
|
||||
rsa_bits = 4096
|
||||
}
|
||||
|
||||
resource "aws_key_pair" "devops_kp" {
|
||||
key_name = "devops-kp"
|
||||
public_key = tls_private_key.devops_kp.public_key_openssh
|
||||
}
|
||||
|
||||
# --- Default VPC + its default security group ---
|
||||
data "aws_vpc" "default" {
|
||||
default = true
|
||||
}
|
||||
|
||||
data "aws_security_group" "default" {
|
||||
vpc_id = data.aws_vpc.default.id
|
||||
name = "default"
|
||||
}
|
||||
|
||||
# --- EC2 instance ---
|
||||
resource "aws_instance" "devops_ec2" {
|
||||
ami = "ami-0c101f26f147fa7fd"
|
||||
instance_type = "t2.micro"
|
||||
key_name = aws_key_pair.devops_kp.key_name
|
||||
vpc_security_group_ids = [data.aws_security_group.default.id]
|
||||
|
||||
credit_specification {
|
||||
cpu_credits = "standard"
|
||||
}
|
||||
|
||||
tags = {
|
||||
Name = "devops-ec2"
|
||||
}
|
||||
}
|
||||
17
terraform/007/task-7.md
Normal file
17
terraform/007/task-7.md
Normal file
@@ -0,0 +1,17 @@
|
||||
The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the AWS cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units.
|
||||
|
||||
For this task, create an EC2 instance using Terraform with the following requirements:
|
||||
|
||||
The EC2 instance must use the value devops-ec2 as its Name tag, which defines the instance name in AWS.
|
||||
|
||||
Use the Amazon Linux ami-0c101f26f147fa7fd to launch this instance.
|
||||
|
||||
The Instance type must be t2.micro.
|
||||
|
||||
Create a new RSA key named devops-kp.
|
||||
|
||||
Attach the default (available by default) security group.
|
||||
|
||||
The Terraform working directory is /home/bob/terraform. Create the main.tf file (do not create a different .tf file) to provision the instance.
|
||||
|
||||
Note: Right-click under the EXPLORER section in VS Code and select Open in Integrated Terminal to launch the terminal.
|
||||
Reference in New Issue
Block a user