Skip to content

Commit 27d2183

Browse files
author
lerndevops
authored
Create 1. basic_ec2
1 parent 894a5be commit 27d2183

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

terraform/examples/1. basic_ec2

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### vim main.tf
2+
3+
provider "aws" {
4+
region = "us-east-1"
5+
access_key = "AKIAVATL2WTVUK7H5HK2"
6+
secret_key = "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"
7+
}
8+
9+
resource "aws_instance" "test-instances" {
10+
ami = "ami-02aa7f3de34db391a"
11+
count = "4"
12+
instance_type = "t2.micro"
13+
key_name = "du-devops"
14+
user_data = <<-EOF
15+
#! /bin/bash
16+
sudo apt-get update
17+
sudo git clone http://github.com/lerndevops/labs
18+
sudo chmod -R 775 labs
19+
sudo labs/cloud/setup-user.sh
20+
EOF
21+
22+
tags = {
23+
Name = "test${count.index + 1}"
24+
training = "devops"
25+
}
26+
}
27+
28+
29+
30+
#terraform init
31+
#terraform plan
32+
#terraform apply

0 commit comments

Comments
 (0)