-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-server.tf
39 lines (37 loc) · 1.08 KB
/
wp-server.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
data "template_file" "provision_wp" {
template = file("scripts/add-wp.yaml")
}
# Use your own server name instead of 'wpserver'
resource "aws_instance" "wpserver" {
ami = "ami-02d63d6d135e3f0f0"
instance_type = "t2.micro"
# Use your own .pem key
key_name = "CloudBroWRCSI"
vpc_security_group_ids = [aws_security_group.wp-server.id]
# Use your own security group name instead of 'wp-server'
associate_public_ip_address = true
# Provision everything included in add-wp.yaml using cloud-init
user_data = data.template_file.provision_wp.rendered
root_block_device {
volume_type = "gp2"
volume_size = "8"
delete_on_termination = true
}
# Fill these tags with your data
tags = {
Name = "Isti_Wordpress"
Email = "[email protected]"
Comment = "Made with Terraform"
}
connection {
type = "ssh"
host = aws_instance.wpserver.public_ip
user = "ubuntu"
private_key = file("CloudBroWRCSI.pem")
}
# A none too elegant solution to copy a conf file to the created EC2 instance
provisioner "file" {
source = "scripts/wordpress.conf"
destination = "/tmp/wordpress.conf"
}
}