OTC: Retrieve Debian Image ID from Terraform Data Source

This commit is contained in:
Sebastian Haderecker 2021-02-05 16:07:53 +01:00
parent b214bed014
commit 98c7dd17d7
3 changed files with 5 additions and 7 deletions

View file

@ -93,7 +93,6 @@ In `otc/variables.tf`, you can change the additional variables:
* `availability_zone` * `availability_zone`
* `flavor` * `flavor`
* `key_pair` - Specify an existing SSH key pair * `key_pair` - Specify an existing SSH key pair
* `image_id`
* `volume_size` * `volume_size`
Furthermore you can configure the naming of the created infrastructure (per default everything gets prefixed with "tpot-", e.g. "tpot-router"). Furthermore you can configure the naming of the created infrastructure (per default everything gets prefixed with "tpot-", e.g. "tpot-router").

View file

@ -1,3 +1,7 @@
data "opentelekomcloud_images_image_v2" "debian" {
name = "Standard_Debian_10_latest"
}
resource "opentelekomcloud_networking_secgroup_v2" "secgroup_1" { resource "opentelekomcloud_networking_secgroup_v2" "secgroup_1" {
name = var.secgroup_name name = var.secgroup_name
description = var.secgroup_desc description = var.secgroup_desc
@ -48,7 +52,7 @@ resource "opentelekomcloud_compute_instance_v2" "ecs_1" {
} }
block_device { block_device {
uuid = var.image_id uuid = data.opentelekomcloud_images_image_v2.debian.id
source_type = "image" source_type = "image"
volume_size = var.volume_size volume_size = var.volume_size
destination_type = "volume" destination_type = "volume"

View file

@ -49,11 +49,6 @@ variable "key_pair" {
description = "Specify your SSH key pair" description = "Specify your SSH key pair"
} }
variable "image_id" {
default = "cf471250-a755-4df8-8c42-6faa5a224ea0"
description = "Select a Debian 10 base image id"
}
variable "volume_size" { variable "volume_size" {
default = "128" default = "128"
description = "Set the volume size" description = "Set the volume size"