From d967eab8012de16e947f5219268bbea349d6315a Mon Sep 17 00:00:00 2001 From: Krish Moodbidri <krish94@uab.edu> Date: Thu, 2 May 2024 14:49:50 -0500 Subject: [PATCH] Integrate S3 backend with environment variable-based authentication Updated the Terraform configuration to leverage S3 for state management using environment variables for AWS credentials. This change improves security by utilizing the built-in support for AWS credentials management, ensuring that sensitive keys are not hardcoded in the Terraform files. --- ohpc-instance/main.tf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ohpc-instance/main.tf b/ohpc-instance/main.tf index a1ce248..44b8047 100644 --- a/ohpc-instance/main.tf +++ b/ohpc-instance/main.tf @@ -7,6 +7,13 @@ required_version = ">= 0.14.0" version = "~> 1.42.0" } } + backend "s3" { + bucket = "my-terraform-state-bucket" + key = "state/terraform.tfstate" + region = "us-east-1" + encrypt = true + dynamodb_table = "my-terraform-lock-table" + } } @@ -84,7 +91,7 @@ resource "openstack_compute_volume_attach_v2" "attach_prod_volume" { resource "openstack_compute_volume_attach_v2" "attach_prod_queue_volume" { instance_id = openstack_compute_instance_v2.ohpc.id - volume_id = var.xdmod_queue_data_volume + volume_id = var.prod_volume_id } output "xdmod_instance_id" { value = openstack_compute_instance_v2.ohpc.id -- GitLab