Skip to content
Snippets Groups Projects
Commit 32f4bf86 authored by Mingyuan Chen's avatar Mingyuan Chen
Browse files

change 1

parent a8b4e3b2
No related branches found
No related tags found
No related merge requests found
terraform {
required_version = ">= 0.14.0"
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
......@@ -8,7 +8,7 @@ required_version = ">= 0.14.0"
}
}
resource "openstack_networking_floatingip_v2" "floating_ip" {
resource "openstack_networking_floatingip_v2" "floating_ip_1" {
pool = var.pool
}
......@@ -21,12 +21,14 @@ resource "openstack_compute_secgroup_v2" "security_group" {
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
rule {
from_port = 8080
to_port = 8080
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
rule {
from_port = 8083
to_port = 8083
......@@ -34,9 +36,8 @@ resource "openstack_compute_secgroup_v2" "security_group" {
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_instance_v2" "instance" {
name = var.name
resource "openstack_compute_instance_v2" "instance_1" {
name = var.name1
image_name = var.image
flavor_name = var.flavor
security_groups = [openstack_compute_secgroup_v2.security_group.name]
......@@ -46,9 +47,7 @@ resource "openstack_compute_instance_v2" "instance" {
name = var.network
}
}
resource "openstack_compute_floatingip_associate_v2" "floating_ip" {
# floating_ip = "10.72.101.35"
floating_ip = openstack_networking_floatingip_v2.floating_ip.address
instance_id = openstack_compute_instance_v2.instance.id
resource "openstack_compute_floatingip_associate_v2" "floating_ip_1" {
floating_ip = openstack_networking_floatingip_v2.floating_ip_1.address
instance_id = openstack_compute_instance_v2.instance_1.id
}
variable "flavor" { default = "m1.large" }
variable "image" { default = "Rocky 9.5 20241118" }
variable "name" { default = "JenkinsServer" }
variable "image" { default = "Rocky Linux 9 20220830" }
variable "name1" { default = "JenkinsServer" }
variable "keypair" { default = "c" } # you may need to change this
variable "network" { default = "c" } # you need to change this
variable "keypair" { default = "c" } # you need to change this
variable "pool" { default = "cscloud_private_floating" }
variable "server_script" { default = "./server1.sh" }
variable "server1_script" { default = "./server1.sh" }
variable "security_description" { default = "Terraform security group" }
variable "security_name" { default = "tmptf_security" }
variable "security_name" { default = "tf_securityMat" }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment