Skip to content

Commit ce91d87

Browse files
committed
Terroform assets for jupyter
1 parent 78928b9 commit ce91d87

14 files changed

+83
-40
lines changed

Taskfile.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ tasks:
5555
TF_COMMAND: destroy
5656

5757
plan:
58-
desc: get remote_fqdn
58+
desc: plan
5959
deps:
6060
- task: run_tf_command
6161
vars:
@@ -69,7 +69,7 @@ tasks:
6969
TF_COMMAND: output -raw REMOTE_FQDN
7070

7171
get_remote_user:
72-
desc: get remote_fqdn
72+
desc: get remote_user
7373
deps:
7474
- task: run_tf_command
7575
vars:

data__openstack_blockstorage_volume_v3.tf

Lines changed: 0 additions & 4 deletions
This file was deleted.

data__openstack_images_image_v2.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
data openstack_images_image_v2 base_image {
22
name = var.BASE_IMAGE
33
most_recent = true
4-
}
4+
}

data__openstack_networking_floatingip_v2.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
data openstack_networking_network_v2 private {
2-
name = "private"
3-
}
2+
name = local.INSTANCE_NETWORK
3+
}
4+
5+
6+
data "openstack_networking_subnet_ids_v2" "intra_subnets" {
7+
network_id = openstack_networking_network_v2.intra_network.id
8+
}
9+
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
resource openstack_blockstorage_volume_v3 persistent-volumes {
2+
for_each = local.PERSISTENT_VOLUMES_NAME
3+
name = each.value
4+
size = 77
5+
}
6+
7+
resource openstack_networking_floatingip_v2 instance {
8+
pool = "public-2"
9+
}
10+
111
resource openstack_compute_instance_v2 instance {
212
name = var.INSTANCE_FQDN
313
image_id = data.openstack_images_image_v2.base_image.id
@@ -9,30 +19,15 @@ resource openstack_compute_instance_v2 instance {
919
port = openstack_networking_port_v2.instance.id
1020
}
1121

12-
#user_data = templatefile("${path.module}/user_data.tmpl", {
13-
# fqdn = local.INSTANCE_FQDN
14-
# timezone = local.TIMEZONE
15-
# ntp_servers = local.NTP_SERVERS
16-
# ssh_authorized_keys = data.external.ssh_authorized_keys.result
17-
# ssh_host_keys = data.external.ssh_host_keys.result
18-
#})
1922
connection {
2023
type = "ssh"
2124
agent = true
22-
host = data.openstack_networking_floatingip_v2.instance.address
25+
host = openstack_networking_floatingip_v2.instance.address
2326
user = var.REMOTE_USER
2427
}
2528
provisioner remote-exec {
2629
inline = [ "hostname" ]
2730
}
28-
#provisioner "local-exec" {
29-
# environment = {
30-
# REMOTE_USER = var.REMOTE_USER
31-
# REMOTE_FQDN = data.openstack_networking_floatingip_v2.instance.address
32-
# }
33-
# working_dir = dirname(abspath(path.root))
34-
# command = "pwd && task provisioner:install"
35-
#
36-
#}
3731

38-
}
32+
}
33+
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
12
resource openstack_compute_volume_attach_v2 persistent-volumes {
2-
for_each = data.openstack_blockstorage_volume_v3.persistent-volumes
3+
for_each = openstack_blockstorage_volume_v3.persistent-volumes
34
instance_id = openstack_compute_instance_v2.instance.id
45
volume_id = each.value.id
5-
}
6+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
2+
13
resource openstack_networking_floatingip_associate_v2 instance {
2-
floating_ip = data.openstack_networking_floatingip_v2.instance.address
4+
floating_ip = openstack_networking_floatingip_v2.instance.address
35
port_id = openstack_networking_port_v2.instance.id
4-
}
6+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
3+
resource "openstack_networking_network_v2" "intra_network" {
4+
name = "jup-ng-staging"
5+
}
6+
7+
8+
resource "openstack_networking_subnet_v2" "intra_subnet" {
9+
network_id = openstack_networking_network_v2.intra_network.id
10+
name = "main"
11+
cidr = "192.168.0.0/24"
12+
gateway_ip = "192.168.0.254"
13+
dns_nameservers = ["8.8.8.8"]
14+
}
15+
16+
resource "openstack_networking_router_v2" "jup_ng_router" {
17+
name = "jup-ng"
18+
external_network_id = data.openstack_networking_network_v2.private.id
19+
}
20+
21+
resource "openstack_networking_router_interface_v2" "jup_ng_interface" {
22+
router_id = openstack_networking_router_v2.jup_ng_router.id
23+
subnet_id = openstack_networking_subnet_v2.intra_subnet.id
24+
}
25+
26+
resource "openstack_networking_router_route_v2" "router_route_1" {
27+
depends_on = [openstack_networking_router_interface_v2.jup_ng_interface]
28+
router_id = openstack_networking_router_v2.jup_ng_router.id
29+
destination_cidr = "157.136.248.0/21"
30+
next_hop = "157.136.248.1"
31+
}
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11

2+
3+
resource "openstack_networking_subnet_route_v2" "subnet_route_1" {
4+
subnet_id = openstack_networking_subnet_v2.intra_subnet.id
5+
destination_cidr = "157.136.248.0/21"
6+
next_hop = "157.136.248.1"
7+
}
8+
29
resource openstack_networking_port_v2 instance {
310
name = local.INSTANCE_FQDN
4-
network_id = data.openstack_networking_network_v2.private.id
11+
network_id = openstack_networking_network_v2.intra_network.id
512
admin_state_up = "true"
6-
}
13+
14+
fixed_ip {
15+
subnet_id = openstack_networking_subnet_v2.intra_subnet.id
16+
}
17+
}

0 commit comments

Comments
 (0)