Merge branch 'main' into fix_tags

This commit is contained in:
Nicolas Boufidjeline 2022-07-01 18:32:34 +02:00
commit 6417039cfd
No known key found for this signature in database
GPG Key ID: 8DC009DF411D3BE1

12
main.tf
View File

@ -1,15 +1,15 @@
data "netbox_prefix" "test" { data "netbox_prefix" "network" {
cidr = var.netbox_prefix cidr = var.netbox_prefix
} }
resource "netbox_available_ip_address" "test" { resource "netbox_available_ip_address" "available_ip" {
prefix_id = data.netbox_prefix.test.id prefix_id = data.netbox_prefix.network.id
description = var.name description = var.name
dns_name = var.dns_name dns_name = var.dns_name
} }
output "ip_addr" { output "ip_addr" {
value = netbox_available_ip_address.test.ip_address value = netbox_available_ip_address.available_ip.ip_address
} }
data "xenorchestra_sr" "local_storage" { data "xenorchestra_sr" "local_storage" {
@ -39,7 +39,7 @@ resource "xenorchestra_vm" "bar" {
ssh_keys = var.ssh_keys ssh_keys = var.ssh_keys
}) })
cloud_network_config = templatefile("cloud_network_config.tftpl", { cloud_network_config = templatefile("cloud_network_config.tftpl", {
ip = "${replace(netbox_available_ip_address.test.ip_address, "var.netmask_netbox", var.netmask)}" ip = "${replace(netbox_available_ip_address.available_ip.ip_address, "var.netmask_netbox", var.netmask)}"
gateway = var.gateway gateway = var.gateway
}) })
name_label = var.name name_label = var.name
@ -70,7 +70,7 @@ resource "local_file" "inventory" {
filename = "inventory" filename = "inventory"
content = <<EOF content = <<EOF
[all] [all]
${split("/", netbox_available_ip_address.test.ip_address)[0]} ${split("/", netbox_available_ip_address.available_ip.ip_address)[0]}
EOF EOF
} }