File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
modules/tfe_init_replicated Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 4
4
locals {
5
5
get_base64_secrets = templatefile (" ${ path . module } /templates/get_base64_secrets.func" , {
6
6
cloud = var.cloud
7
+ distribution = var.distribution
7
8
})
8
9
9
10
install_packages = templatefile (" ${ path . module } /templates/install_packages.func" , {
Original file line number Diff line number Diff line change @@ -11,10 +11,15 @@ function get_base64_secrets {
11
11
12
12
%{ if cloud == "aws" ~}
13
13
function get_base64_secrets {
14
- # Description: Pull the Base 64 encoded secrets from AWS Secrets Manager
15
14
local secret_id=$1
16
- # OS: Agnostic
17
- /usr/local/bin/aws secretsmanager get-secret-value --secret-id $secret_id | jq --raw-output '.SecretBinary,.SecretString | select(. != null)'
15
+ %{ if distribution == "amazon-linux-2023" ~}
16
+ # Amazon Linux 2023 already has AWS installed on the machine
17
+ aws secretsmanager get-secret-value --secret-id $secret_id | jq --raw-output '.SecretBinary,.SecretString | select(. != null)'
18
+ %{ else ~}
19
+ # OS: Agnostic
20
+ # Description: Pull the Base 64 encoded secrets from AWS Secrets Manager
21
+ /usr/local/bin/aws secretsmanager get-secret-value --secret-id $secret_id | jq --raw-output '.SecretBinary,.SecretString | select(. != null)'
22
+ %{ endif ~}
18
23
}
19
24
%{ endif ~}
20
25
Original file line number Diff line number Diff line change @@ -36,12 +36,15 @@ function install_packages {
36
36
%{ endif ~}
37
37
%{ endif ~}
38
38
39
- echo "[$(date +"%FT%T")] [Terraform Enterprise] Install AWS CLI" | tee -a $log_pathname
40
- curl --noproxy '*' "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
41
- unzip awscliv2.zip
42
- ./aws/install
43
- rm -f ./awscliv2.zip
44
- rm -rf ./aws
39
+ # Amazon Linux 2023 already has AWS installed on the machine so no need to install it there.
40
+ %{ if distribution != "amazon-linux-2023" ~}
41
+ echo "[$(date +"%FT%T")] [Terraform Enterprise] Install AWS CLI" | tee -a $log_pathname
42
+ curl --noproxy '*' "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
43
+ unzip awscliv2.zip
44
+ ./aws/install
45
+ rm -f ./awscliv2.zip
46
+ rm -rf ./aws
47
+ %{ endif ~}
45
48
}
46
49
%{ endif ~}
47
50
You can’t perform that action at this time.
0 commit comments