Infra: AWS/Azure fix OOM issues on smaller instances
[csit.git] / terraform-ci-infra / 2n_aws_c5n / deploy / main.tf
index 7fe8151..f97d974 100644 (file)
@@ -218,6 +218,7 @@ data "aws_network_interface" "tg_if2" {
 
 # Instances
 resource "aws_instance" "tg" {
+  depends_on                  = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
   ami                         = var.ami_image
   availability_zone           = var.avail_zone
   instance_type               = var.instance_type
@@ -228,7 +229,6 @@ resource "aws_instance" "tg" {
   vpc_security_group_ids      = [aws_security_group.CSITSG.id]
   placement_group             = aws_placement_group.CSITPG.id
   source_dest_check           = false
-  depends_on                  = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
   # host_id                   = "1"
 
   root_block_device {
@@ -242,6 +242,7 @@ resource "aws_instance" "tg" {
 }
 
 resource "aws_instance" "dut1" {
+  depends_on                  = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
   ami                         = var.ami_image
   availability_zone           = var.avail_zone
   instance_type               = var.instance_type
@@ -252,7 +253,6 @@ resource "aws_instance" "dut1" {
   vpc_security_group_ids      = [aws_security_group.CSITSG.id]
   placement_group             = aws_placement_group.CSITPG.id
   source_dest_check           = false
-  depends_on                  = [aws_vpc.CSITVPC, aws_placement_group.CSITPG]
   # host_id                   = "2"
 
   root_block_device {
@@ -319,6 +319,11 @@ resource "null_resource" "deploy_tg" {
       }
     }
   }
+
+  provisioner "remote-exec" {
+    on_failure = continue
+    inline = ["sudo reboot"]
+  }
 }
 
 resource "null_resource" "deploy_dut1" {
@@ -352,6 +357,11 @@ resource "null_resource" "deploy_dut1" {
       }
     }
   }
+
+  provisioner "remote-exec" {
+    on_failure = continue
+    inline = ["sudo reboot"]
+  }
 }
 
 resource "null_resource" "deploy_topology" {