forked from vikas99341/Terraform-codes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attributes.tf
51 lines (39 loc) · 879 Bytes
/
attributes.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
provider "aws" {
region = "us-east-1"
}
resource "aws_eip" "lb" {
vpc = true
}
output "eip" {
value = aws_eip.lb.public_ip
}
resource "aws_s3_bucket" "mys3" {
bucket = "demo-attribute-demo-001"
}
output "mys3bucket" {
value = aws_s3_bucket.mys3.bucket_domain_name
}
====================================================
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "myec2" {
ami = "ami-082b5a644766e0e6f"
instance_type = "t2.micro"
}
resource "aws_eip" "lb" {
vpc = true
}
resource "aws_eip_association" "eip_assoc" {
instance_id = aws_instance.myec2.id
allocation_id = aws_eip.lb.id
}
resource "aws_security_group" "allow_tls" {
name = "kplabs-security-group"
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["${aws_eip.lb.public_ip}/32"]
}
}