Initial version

This commit is contained in:
Magnus Andersson 2024-04-29 14:49:34 +02:00
commit 06367914c7
Signed by: mandersson
GPG key ID: 19CB2C58E1F19B16
6 changed files with 70 additions and 0 deletions

2
.tfvars Normal file
View file

@ -0,0 +1,2 @@
caname = "dtca-test"
cadbname = "dtcadb-test"

28
dtca.tf Normal file
View file

@ -0,0 +1,28 @@
resource "openstack_networking_port_v2" "dtcaport" {
name = "${dtcaname}-sunet-se-port"
network_id = data.openstack_networking_network_v2.public.id
# A list of security group ID
security_group_ids = [
data.openstack_networking_secgroup_v2.sshfromjumphosts.id,
data.openstack_networking_secgroup_v2.allegress.id
]
admin_state_up = "true"
lifecycle {
prevent_destroy = true
}
}
resource "openstack_networking_port_v2" "dtcadbport" {
name = "${dtcadbname}-sunet-se-port"
network_id = data.openstack_networking_network_v2.public.id
# A list of security group ID
security_group_ids = [
data.openstack_networking_secgroup_v2.sshfromjumphosts.id,
data.openstack_networking_secgroup_v2.allegress.id
]
admin_state_up = "true"
lifecycle {
prevent_destroy = true
}
}

22
main.tf Normal file
View file

@ -0,0 +1,22 @@
# Define required providers
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.53.0"
}
local = {
source = "hashicorp/local"
version = "2.4.1"
}
}
}
provider "openstack" {
# Source application credentials to use environemnt variables to provide auth
}
provider "local" {
# Configuration options
}

3
network.tf Normal file
View file

@ -0,0 +1,3 @@
data "openstack_networking_network_v2" "public" {
name = "sunet.se-public"
}

8
securitygroups.tf Normal file
View file

@ -0,0 +1,8 @@
# Datasource of sunet ssh-from-jumphost security group.
data "openstack_networking_secgroup_v2" "sshfromjumphosts" {
name = "ssh-from-jumphost"
}
data "openstack_networking_secgroup_v2" "allegress" {
name = "Allow all outgoing"
}

7
vars.tf Normal file
View file

@ -0,0 +1,7 @@
variable "caname" {
type = string
}
variable "cadbname" {
type = string
}