mirror of
https://github.com/dap-ps/infra-dapps.git
synced 2025-02-23 09:28:09 +00:00
add creation of AWS instance and record for it
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
2a7cdb640c
commit
0952abdc59
39
main.tf
39
main.tf
@ -105,8 +105,8 @@ resource "gandi_zonerecord" "dap_ps_mail_spf" {
|
||||
}
|
||||
|
||||
resource "gandi_domainattachment" "dap_ps" {
|
||||
domain = "${var.public_domain}"
|
||||
zone = "${gandi_zone.dap_ps_zone.id}"
|
||||
domain = "${var.public_domain}"
|
||||
zone = "${gandi_zone.dap_ps_zone.id}"
|
||||
}
|
||||
|
||||
/* MAIL SITE ------------------------------------*/
|
||||
@ -124,3 +124,38 @@ resource "gandi_zonerecord" "dap_ps_site" {
|
||||
"185.199.111.153",
|
||||
]
|
||||
}
|
||||
|
||||
/* RESOURCES ------------------------------------*/
|
||||
|
||||
resource "aws_key_pair" "admin" {
|
||||
key_name = "admin-key"
|
||||
public_key = "${file("admin.pub")}"
|
||||
}
|
||||
|
||||
data "aws_ami" "ubuntu" {
|
||||
filter {
|
||||
name = "name"
|
||||
values = ["${var.image_name}"]
|
||||
}
|
||||
|
||||
owners = ["099720109477"]
|
||||
}
|
||||
|
||||
resource "aws_instance" "dap_ps_dev" {
|
||||
ami = "${data.aws_ami.ubuntu.id}"
|
||||
instance_type = "${var.instance_type}"
|
||||
availability_zone = "${var.zone}"
|
||||
key_name = "${aws_key_pair.admin.key_name}"
|
||||
|
||||
tags = {
|
||||
Name = "node-01.${var.zone}.${var.env}.test"
|
||||
}
|
||||
}
|
||||
|
||||
resource "gandi_zonerecord" "main" {
|
||||
zone = "${gandi_zone.dap_ps_zone.id}"
|
||||
name = "dev"
|
||||
type = "A"
|
||||
ttl = 3600
|
||||
values = ["${aws_instance.dap_ps_dev.public_ip}"]
|
||||
}
|
||||
|
16
variables.tf
16
variables.tf
@ -31,7 +31,17 @@ variable env {
|
||||
default = "dapps"
|
||||
}
|
||||
|
||||
variable region {
|
||||
description = "Name of region to deploy to"
|
||||
default = "us-east-1"
|
||||
variable zone {
|
||||
description = "Name of availability zone to deploy to."
|
||||
default = "us-east-1a"
|
||||
}
|
||||
|
||||
variable image_name {
|
||||
description = "Name of AMI image to use."
|
||||
default = "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20190212.1"
|
||||
}
|
||||
|
||||
variable instance_type {
|
||||
description = "Name of instance type to use"
|
||||
default = "t3.medium"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user