From cd81e921429b862e16bd0d0ffe263d0f179b266e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 May 2025 19:59:09 +0200 Subject: [PATCH] pci-test ex3 --- .gitignore | 41 +++++++++++++++++++++++++++++++++++++++++ ex3/main.tf | 31 +++++++++++++++++++++++++++++++ ex3/openrc | 1 - 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 ex3/main.tf delete mode 100644 ex3/openrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bb4c33 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +#.gitignore +#ex3/*.terraform* +#ex3/terraform* + +# Local .terraform directories +**/.terraform* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore transient lock info files created by terraform apply +.terraform.tfstate.lock.info + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc diff --git a/ex3/main.tf b/ex3/main.tf new file mode 100644 index 0000000..9cad8aa --- /dev/null +++ b/ex3/main.tf @@ -0,0 +1,31 @@ +terraform { +required_version = ">= 0.14.0" + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "~> 1.53.0" + } + } +} + +resource "openstack_networking_floatingip_v2" "_3245829148481055-FIP" { + pool = "Ext-Net" +} + +resource "openstack_compute_instance_v2" "_3245829148481055-pci-test-ex3" { + name = "_3245829148481055-pci-test-ex3" + image_id = "d2083aa0-94ee-491d-a20c-0c8db1acdb96" + flavor_name = "d2-4" + key_pair = "3245829148481055-KP" + security_groups = ["default"] + user_data = "#cloud-config\npackages:\n - nginx\nruncmd:\n - systemctl enable nginx\n - systemctl start nginx" + + network { + name = "3245829148481055-int-net" + } +} + +resource "openstack_compute_floatingip_associate_v2" "_3245829148481055-FIP" { + floating_ip = "${openstack_networking_floatingip_v2._3245829148481055-FIP.address}" + instance_id = "${openstack_compute_instance_v2._3245829148481055-pci-test-ex3.id}" +} diff --git a/ex3/openrc b/ex3/openrc deleted file mode 100644 index dcf2c80..0000000 --- a/ex3/openrc +++ /dev/null @@ -1 +0,0 @@ -# Placeholder