generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally add ECS cluster SSM policies
* This conditionally adds the policies with permissions required to use SSM default host management configuration. * It checks for the value of the service setting to ensure dhcm has been enabled to decide wether to add the policies. `aws_ssm_service_setting` doesn't yet have a data source (hashicorp/terraform-provider-aws#25170), so it uses a script along with the `external` provider instead to get the service setting parameters.
- Loading branch information
Showing
9 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
eval "$(jq -r '@sh "SSM_SERVICE_SETTING_ID=\(.setting_id)"')" | ||
|
||
SERVICE_SETTING="$(aws ssm get-service-setting --setting-id "$SSM_SERVICE_SETTING_ID" | jq -cr '.ServiceSetting')" | ||
|
||
#SETTING_ID="$(echo "$SERVICE_SETTING" | jq -cr '.SettingId')" | ||
#SETTING_VALUE="$(echo "$SERVICE_SETTING" | jq -cr 'SettingValue')" | ||
#LAST_MODIFIED_DATE="$(echo "$SERVICE_SETTING" | jq -cr '.LastModifiedDate')" | ||
#LAST_MODIFIED_USER="$(echo "$SERVICE_SETTING" | jq -cr '.LastModifiedUser')" | ||
#ARN="$(echo "$SERVICE_SETTING" | jq -cr '.ARN')" | ||
#STATUS="$(echo "$SERVICE_SETTING" | jq -cr '.Status')" | ||
# | ||
#jq -n \ | ||
# --arg setting_id "$SETTING_ID" \ | ||
# --arg setting_value "$SETTING_VALUE" \ | ||
# --arg last_modified_date "$LAST_MODIFIED_DATE" \ | ||
# --arg last_modified_user "$LAST_MODIFIED_USER" \ | ||
# --arg arn "$ARN" \ | ||
# --arg status "$STATUS" \ | ||
# '{ | ||
# setting_id = | ||
# }' | ||
|
||
jq -ncr --argjson service_setting "$SERVICE_SETTING" \ | ||
'$service_setting | { | ||
setting_id: .SettingId, | ||
setting_value: .SettingValue, | ||
last_modified_date: .LastModifiedDate, | ||
last_modified_user: .LastModifiedUser, | ||
arn: .ARN, | ||
status: .Status | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:PassRole" | ||
], | ||
"Resource": "${role_arn}", | ||
"Condition": { | ||
"StringEquals": { | ||
"iam:PassedToService": [ | ||
"${service}" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"ssm:GetServiceSetting", | ||
"ssm:ResetServiceSetting", | ||
"ssm:UpdateServiceSetting" | ||
], | ||
"Resource": "${ssm_service_setting_arn}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters