add updates based on running the workshop
This commit is contained in:
parent
40f9f9a264
commit
a082c27945
|
@ -70,7 +70,9 @@ output "instance_public_ip" {
|
|||
|
||||
* Set up local credentials for your cloud platform of choice
|
||||
|
||||
* Write a file that deploys an EC2 instance
|
||||
* Write a file that deploys an EC2 instance (main.tf)
|
||||
|
||||
* Use `terraform init` to initialize
|
||||
|
||||
* Use `terraform plan` and `terraform apply` in order to deploy the resource
|
||||
|
||||
|
@ -78,9 +80,7 @@ output "instance_public_ip" {
|
|||
|
||||
* Take advantage of terraform docs and providers:
|
||||
|
||||
* https://registry.terraform.io/
|
||||
|
||||
* https://developer.hashicorp.com/terraform
|
||||
* https://registry.terraform.io/ & https://developer.hashicorp.com/terraform
|
||||
|
||||
---
|
||||
|
||||
|
@ -142,16 +142,16 @@ resource "aws_security_group" "default_egress" {
|
|||
description = "Specify egress for instance"
|
||||
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
}
|
||||
|
||||
# Specify the provider
|
||||
provider "aws" {
|
||||
region = "us-west-2"
|
||||
resource "aws_key_pair" "my_key" {
|
||||
key_name = "my-key-pair"
|
||||
public_key = file("~/.ssh/my-key-pair.pub") # Path to your public key file
|
||||
}
|
||||
|
||||
# Create an EC2 instance
|
||||
|
@ -159,6 +159,9 @@ resource "aws_instance" "my_ec2" {
|
|||
ami = "ami-03e383d33727f4804"
|
||||
instance_type = "t2.micro"
|
||||
|
||||
associate_public_ip_address = true
|
||||
key_name = aws_key_pair.my_key.key_name
|
||||
|
||||
security_groups = [
|
||||
aws_security_group.allow_ssh.name,
|
||||
aws_security_grou.default_egress.name
|
||||
|
|
Loading…
Reference in New Issue