Skip to content

Commit

Permalink
updates to support mrap arn passing
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycook123 committed Jun 12, 2024
1 parent a13e650 commit 55052f8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions labfiles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resource "aws_iam_instance_profile" "lab_instance" {
role = "lab_instance_mrap"
}

data "aws_caller_identity" "current" {}

# REGION1 VPC
# ============================

Expand Down Expand Up @@ -118,9 +120,21 @@ resource "aws_instance" "region1" {
cpu_credits = "standard"
}

user_data = <<-EOFF
#!/usr/bin/env bash
set -x
cat >> /home/ec2-user/.bash_profile << EOF
export AWS_ACCOUNT_ID=${data.aws_caller_identity.current.account_id}
export AWS_S3_MRAP_ARN=${var.s3_mrap_arn}
EOF
EOFF

tags = {
Name = "lab-instance-region1"
}


}

resource "aws_vpc_endpoint" "ssm_region1" {
Expand Down Expand Up @@ -275,6 +289,16 @@ resource "aws_instance" "region2" {
cpu_credits = "standard"
}

user_data = <<-EOFF
#!/usr/bin/env bash
set -x
cat >> /home/ec2-user/.bash_profile << EOF
export AWS_ACCOUNT_ID=${data.aws_caller_identity.current.account_id}
export AWS_S3_MRAP_ARN=${var.s3_mrap_arn}
EOF
EOFF

tags = {
Name = "lab-instance-region2"
}
Expand Down
4 changes: 4 additions & 0 deletions labfiles/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "s3_mrap_arn" {
description = "S3 multi-region access point ARN"
type = string
}

0 comments on commit 55052f8

Please sign in to comment.