From 052192ebf0a1029c4bd966ed4c2922aaabc7e992 Mon Sep 17 00:00:00 2001 From: Jan Orel Date: Tue, 22 Mar 2022 09:19:56 +0100 Subject: [PATCH] M #-: OneProvision: move ami search to cluster (#1865) Otherwise there will be duplicites for multiple hosts (cherry picked from commit 1bcc970ba317058384b34523edd2f97b97bdcb8e) --- .../providers/templates/aws/cluster.erb | 17 +++++++++++++++++ .../terraform/providers/templates/aws/host.erb | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/oneprovision/lib/terraform/providers/templates/aws/cluster.erb b/src/oneprovision/lib/terraform/providers/templates/aws/cluster.erb index 7f03f7f7d5..b9264d0aea 100644 --- a/src/oneprovision/lib/terraform/providers/templates/aws/cluster.erb +++ b/src/oneprovision/lib/terraform/providers/templates/aws/cluster.erb @@ -1,3 +1,20 @@ +data "aws_ami" "ubuntu2004" { + + most_recent = true + + filter { + name = "name" + values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] + } + + filter { + name = "virtualization-type" + values = ["hvm"] + } + + owners = ["099720109477"] +} + resource "aws_vpc" "device_<%= obj['ID'] %>" { cidr_block = "<%= provision['CIDR'] ? provision['CIDR'] : '10.0.0.0/16'%>" diff --git a/src/oneprovision/lib/terraform/providers/templates/aws/host.erb b/src/oneprovision/lib/terraform/providers/templates/aws/host.erb index ddb7f82fd6..8746aaa096 100644 --- a/src/oneprovision/lib/terraform/providers/templates/aws/host.erb +++ b/src/oneprovision/lib/terraform/providers/templates/aws/host.erb @@ -1,20 +1,3 @@ -data "aws_ami" "ubuntu2004" { - - most_recent = true - - filter { - name = "name" - values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] - } - - filter { - name = "virtualization-type" - values = ["hvm"] - } - - owners = ["099720109477"] -} - resource "aws_instance" "device_<%= obj['ID'] %>" { <% if provision['AMI'] == 'default' %>