-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ec2.tf #3
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||||||||||||
provider "aws" { | ||||||||||||||
region = "us-west-2" | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
resource "aws_security_group" "ssh_traffic" { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AWS Security Group allows all traffic on SSH port 22
|
||||||||||||||
name = "ssh_traffic" | ||||||||||||||
description = "Allow SSH inbound traffic" | ||||||||||||||
ingress { | ||||||||||||||
description = "SSH" | ||||||||||||||
from_port = 22 | ||||||||||||||
to_port = 22 | ||||||||||||||
protocol = "tcp" | ||||||||||||||
cidr_blocks = ["0.0.0.0/0"] | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
resource "aws_instance" "web_server_instance" { | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Instance Metadata Service version 1 is enabled
|
||||||||||||||
ami = data.aws_ami.ubuntu.id | ||||||||||||||
instance_type = "t2.micro" | ||||||||||||||
security_groups = [ "${aws_security_group.ssh_traffic.name}" ] | ||||||||||||||
tags = { | ||||||||||||||
Name = "bc_workshop_ec2" | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Detailed monitoring for EC2 instances is disabled
|
} | |
ebs_optimized = true | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWS resources that support tags do not have Tags
Resource: aws_security_group.ssh_traffic | ID:
BC_AWS_GENERAL_26
How to Fix
Description
Many different types of AWS resources support tags. Tags allow you to add metadata to a resource to help identify ownership, perform cost / billing analysis, and to enrich a resource with other valuable information, such as descriptions and environment names. While there are many ways that tags can be used, we recommend you follow a tagging practice.View AWS's recommended tagging best practices here.