Skip to content

Commit

Permalink
Added temporarily resources and provider configuration to main.tf to …
Browse files Browse the repository at this point in the history
…se if it deploys
  • Loading branch information
Jon Andre committed Feb 11, 2025
1 parent ee04af9 commit 12581b3
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
17 changes: 17 additions & 0 deletions capev2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "3.0.0"
}
}
}

# Configure the OpenStack Provider
provider "openstack" {
cloud = "openstack"
}

module "capev2" {
source = "../modules/capev2"
}
60 changes: 60 additions & 0 deletions modules/capev2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Define required providers
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "3.0.0"
}
}
}

#
resource "openstack_networking_network_v2" "test_network_1" {
name = "test_network_1"
admin_state_up = "true"
}

resource "openstack_networking_subnet_v2" "test_subnet_1" {
name = "test_subnet_1"
network_id = openstack_networking_network_v2.test_network_1.id
cidr = "192.168.199.0/24"
ip_version = 4
}

resource "openstack_networking_secgroup_v2" "test_secgroup_1" {
name = "test_secgroup_1"
description = "a security group"
}

resource "openstack_networking_secgroup_rule_v2" "test_secgroup_rule_1" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 22
port_range_max = 22
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.test_secgroup_1.id
}

resource "openstack_networking_port_v2" "test_port_1" {
name = "test_port_1"
network_id = openstack_networking_network_v2.test_network_1.id
admin_state_up = "true"
security_group_ids = [openstack_networking_secgroup_v2.test_secgroup_1.id]

fixed_ip {
subnet_id = openstack_networking_subnet_v2.test_subnet_1.id
ip_address = "192.168.199.10"
}
}

resource "openstack_compute_instance_v2" "test_instance_1" {
name = "test_instance_1"
image_name = "Ubuntu Server 20.04 LTS (Focal Fossa) amd64"
flavor_name = "gx3.4c2r"
security_groups = [openstack_networking_secgroup_v2.test_secgroup_1.name]

network {
port = openstack_networking_port_v2.test_port_1.id
}
}
Empty file added modules/capev2/variables.tf
Empty file.

0 comments on commit 12581b3

Please sign in to comment.