File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ provider "aws" {
2
+ region = " us-east-1"
3
+ }
4
+
5
+
6
+ resource "aws_instance" "stage_instance" {
7
+ instance_type = var. instance_type
8
+ ami = var. ami_id
9
+ key_name = " myec2keypair"
10
+ vpc_security_group_ids = [" sg-02d85b5dd5f74c7a7" ]
11
+
12
+ provisioner "file" {
13
+ connection {
14
+ type = " ssh"
15
+ user = " ubuntu"
16
+ private_key = file (" myec2keypair.pem" )
17
+ host = aws_instance. stage_instance . public_ip
18
+ }
19
+ source = " abc.sh"
20
+ destination = " /tmp/abc.sh"
21
+ }
22
+ connection {
23
+ type = " ssh"
24
+ user = " ubuntu"
25
+ private_key = file (" myec2keypair.pem" )
26
+ host = aws_instance. stage_instance . public_ip
27
+ }
28
+ provisioner "remote-exec" {
29
+
30
+
31
+ inline = [
32
+ " chmod +x /tmp/abc.sh" ,
33
+ " /tmp/abc.sh" ,
34
+ ]
35
+ }
36
+
37
+ tags = {
38
+ Name = " stage-instance"
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments