From 4a08f4ad7f5b0d5bd252c2aa53d5c1751fbffdbb Mon Sep 17 00:00:00 2001 From: ehearneredhat Date: Thu, 20 Jun 2024 15:42:23 +0100 Subject: [PATCH] better implementation of tf script for use with github actions and secrets --- self-hosted-runner.tf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/self-hosted-runner.tf b/self-hosted-runner.tf index 58dea3066..a5a3921d0 100644 --- a/self-hosted-runner.tf +++ b/self-hosted-runner.tf @@ -1,5 +1,7 @@ provider "aws" { region = "eu-west-1" + access_key = var.aws_access_key + secret_key = var.aws_secret_key } resource "aws_instance" "example" { @@ -10,7 +12,7 @@ resource "aws_instance" "example" { volume_size = 16 // GB } - key_name = "** INSERT KEY FILE NAME HERE **" + key_name = var.aws_key_name tags = { Name = "kuadrant-operator-self-hosted-runner" @@ -85,7 +87,7 @@ resource "aws_security_group" "ssh_http_https_access" { resource "null_resource" "wait_for_user_data" { provisioner "local-exec" { command = < ubuntu@${aws_instance.example.public_ip} 'test -f /tmp/user_data_done'; do + while ! ssh -o StrictHostKeyChecking=no -i ${aws_instance.example.key_name}.pem ubuntu@${aws_instance.example.public_ip} 'test -f /tmp/user_data_done'; do echo "Waiting for user_data script to complete..." sleep 10 done