-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
46 lines (39 loc) · 970 Bytes
/
main.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
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.48"
}
cloudvps = {
source = "terraform.wmcloud.org/registry/cloudvps"
version = "~> 0.1"
}
}
required_version = ">= 1.3"
}
resource "openstack_compute_instance_v2" "application" {
name = var.resource_prefix
image_id = data.openstack_images_image_v2.image.id
flavor_id = var.instance_type
user_data = file("${path.module}/userdata.sh")
security_groups = var.security_groups
metadata = {
terraform = "Yes"
environment = var.environment
}
network {
uuid = var.network
}
lifecycle {
ignore_changes = [
image_id
]
}
}
resource "openstack_dns_recordset_v2" "application" {
name = var.dns_name
zone_id = var.dns_zone_id
ttl = 180
type = "A"
records = [openstack_compute_instance_v2.application.access_ip_v4]
}