add a common tf script, that can be used for all

This commit is contained in:
Arif Ali 2023-07-10 15:41:26 +01:00
parent 22b51b7416
commit 828d4a6ff4
Signed by: arif
GPG Key ID: 369608FBA1353A70
8 changed files with 34 additions and 65 deletions

View File

@ -0,0 +1,8 @@
resource "openstack_compute_keypair_v2" "arif-key" {
name = "arif-key"
public_key = file("/home/arif/.ssh/aarsa4096canonical.pub")
}
resource "openstack_identity_role_v3" "tenantLead" {
name = "tenantLead"
}

1
openstack/init/00-init.tf Symbolic link
View File

@ -0,0 +1 @@
../00-init.tf

View File

@ -1,51 +0,0 @@
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "1.49.0"
}
}
}
provider "openstack" {
cloud = "arif-home"
}
variable "domain_id" {
type = string
default = "3fd5a53e08e243b49ac3b171d57b4e4a"
}
resource "openstack_compute_keypair_v2" "arif-key" {
name = "arif-key"
public_key = file("/home/arif/.ssh/aarsa4096canonical.pub")
}
resource "openstack_identity_role_v3" "tenantLead" {
name = "tenantLead"
}
resource "openstack_compute_secgroup_v2" "allow_ssh" {
name = "allow_ssh"
description = "Allow ssh"
rule {
from_port = 22
to_port = 22
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "allow_ping" {
name = "allow_ping"
description = "Allow ping"
rule {
from_port = -1
to_port = -1
ip_protocol = "icmp"
cidr = "0.0.0.0/0"
}
}

View File

@ -0,0 +1,23 @@
resource "openstack_compute_secgroup_v2" "allow_ssh" {
name = "allow_ssh"
description = "Allow ssh"
rule {
from_port = 22
to_port = 22
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "allow_ping" {
name = "allow_ping"
description = "Allow ping"
rule {
from_port = -1
to_port = -1
ip_protocol = "icmp"
cidr = "0.0.0.0/0"
}
}

View File

@ -0,0 +1 @@
../00-init.tf

View File

@ -1,17 +1,3 @@
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "1.49.0"
}
}
}
provider "openstack" {
cloud = "arif-home"
}
data "openstack_compute_flavor_v2" "m1_small" {
name = "m1.small"
}

View File

@ -0,0 +1 @@
../00-init.tf