Commit 990d4424 authored by Ryan Jones's avatar Ryan Jones
Browse files

updated with comments

parent 2cfbbdc8
# creates dmznet
resource "openstack_networking_network_v2" "terraform" {
name = "dmznet"
admin_state_up = "true"
}
# creates dmzsubnet using the floating ip defined in datasources.tf to get the network id
# cidr is the subnet range (that subnet range and dns nameservers from the network create file in feat-openstack)
resource "openstack_networking_subnet_v2" "terraform" {
name = "dmzsubnet"
network_id = "${openstack_networking_network_v2.terraform.id}"
......@@ -11,22 +14,26 @@ resource "openstack_networking_subnet_v2" "terraform" {
dns_nameservers = ["8.8.8.8"]
}
# defines the router borderrouter using floating ip defined in datasources.tf to create the external network id
resource "openstack_networking_router_v2" "terraform" {
name = "terraform"
name = "borderrouter"
admin_state_up = "true"
external_network_id = "${data.openstack_networking_network_v2.terraform.id}"
}
# creates the router and subnet id using info defined above
resource "openstack_networking_router_interface_v2" "terraform" {
router_id = "${openstack_networking_router_v2.terraform.id}"
subnet_id = "${openstack_networking_subnet_v2.terraform.id}"
}
# creates a security group
resource "openstack_networking_secgroup_v2" "terraform" {
name = "terraform"
description = "Security group for the Terraform example instances"
}
# creates details of security group fir port 22 and creates security group id
resource "openstack_networking_secgroup_rule_v2" "terraform_22" {
direction = "ingress"
ethertype = "IPv4"
......@@ -37,6 +44,7 @@ resource "openstack_networking_secgroup_rule_v2" "terraform_22" {
security_group_id = "${openstack_networking_secgroup_v2.terraform.id}"
}
# creates details of security group fir port 80 and creates security group id
resource "openstack_networking_secgroup_rule_v2" "terraform_80" {
direction = "ingress"
ethertype = "IPv4"
......@@ -47,6 +55,7 @@ resource "openstack_networking_secgroup_rule_v2" "terraform_80" {
security_group_id = "${openstack_networking_secgroup_v2.terraform.id}"
}
# creates details of security group fir protocol icmp and creates security group id
resource "openstack_networking_secgroup_rule_v2" "terraform" {
direction = "ingress"
ethertype = "IPv4"
......@@ -55,10 +64,12 @@ resource "openstack_networking_secgroup_rule_v2" "terraform" {
security_group_id = "${openstack_networking_secgroup_v2.terraform.id}"
}
# defines where floating ip will come from using variable from vars.tf
resource "openstack_networking_floatingip_v2" "terraform" {
pool = "${var.pool}"
}
# creates details for the instance using variables defined in vars.tf and resource for security groups
resource "openstack_compute_instance_v2" "terraform" {
name = "terraform"
image_name = "${var.image}"
......@@ -66,11 +77,13 @@ resource "openstack_compute_instance_v2" "terraform" {
key_pair = "${var.key_pair}"
security_groups = ["${openstack_networking_secgroup_v2.terraform.name}"]
# defines the instance id using info from datasources.tf
network {
uuid = "${openstack_networking_network_v2.terraform.id}"
}
}
# associates floating ip with the instance
resource "openstack_compute_floatingip_associate_v2" "terraform" {
floating_ip = "${openstack_networking_floatingip_v2.terraform.address}"
instance_id = "${openstack_compute_instance_v2.terraform.id}"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment