Skip to content

Commit 2542068

Browse files
authored
GovCloud support (#10)
1 parent 5205022 commit 2542068

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Check versions for this module on:
4646
| essential | (Optional) Determines whether all other containers in a task are stopped, if this container fails or stops for any reason. Due to how Terraform type casts booleans in json it is required to double quote this value | `bool` | `true` | no |
4747
| firelens\_configuration | (Optional) The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html | <pre>object({<br> type = string<br> options = map(string)<br> })</pre> | `null` | no |
4848
| healthcheck | (Optional) A map containing command (string), timeout, interval (duration in seconds), retries (1-10, number of times to retry before marking container unhealthy), and startPeriod (0-300, optional grace period to wait, in seconds, before failed healthchecks count toward retries) | <pre>object({<br> command = list(string)<br> retries = number<br> timeout = number<br> interval = number<br> startPeriod = number<br> })</pre> | `null` | no |
49+
| iam_partition | (Optional) IAM partition to use when referencing standard policies. GovCloud and some other regions use different partitions | `string` | `aws` | no |
4950
| links | (Optional) List of container names this container can communicate with without port mappings | `list(string)` | `null` | no |
5051
| linux\_parameters | Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LinuxParameters.html | <pre>object({<br> capabilities = object({<br> add = list(string)<br> drop = list(string)<br> })<br> devices = list(object({<br> containerPath = string<br> hostPath = string<br> permissions = list(string)<br> }))<br> initProcessEnabled = bool<br> maxSwap = number<br> sharedMemorySize = number<br> swappiness = number<br> tmpfs = list(object({<br> containerPath = string<br> mountOptions = list(string)<br> size = number<br> }))<br> })</pre> | `null` | no |
5152
| log\_configuration | (Optional) Log configuration options to send to a custom log driver for the container. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html | <pre>object({<br> logDriver = string<br> options = map(string)<br> secretOptions = list(object({<br> name = string<br> valueFrom = string<br> }))<br> })</pre> | `null` | no |

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resource "aws_iam_role" "ecs_task_execution_role" {
99

1010
resource "aws_iam_role_policy_attachment" "ecs_task_execution_role_policy_attach" {
1111
role = aws_iam_role.ecs_task_execution_role.name
12-
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
12+
policy_arn = "arn:${var.iam_partition}:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
1313
}
1414

1515
resource "aws_iam_policy" "ecs_task_execution_role_custom_policy" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ variable "docker_security_options" {
316316
#------------------------------------------------------------------------------
317317
# AWS ECS Task Definition Variables
318318
#------------------------------------------------------------------------------
319+
variable "iam_partition" {
320+
description = "IAM partition to use when referencing standard policies. GovCloud and some other regions use different partitions"
321+
type = string
322+
default = "aws"
323+
}
324+
319325
variable "permissions_boundary" {
320326
description = "(Optional) The ARN of the policy that is used to set the permissions boundary for the `ecs_task_execution_role` role."
321327
type = string

0 commit comments

Comments
 (0)