Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Update ECS plugin for execution and task roles #692

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

surminus
Copy link
Contributor

In ECS, there are two concepts for IAM roles: the execution role[1], that allows AWS to make API calls on your behalf, to do things like pull images from ECR and write logs to CloudWatch; and the task role[2], that allows the containers within your task access to whatever resources you need them to.

Given we almost always need the execution role, it makes sense to have this created by default if it isn't specified.

The task role should not be created by default since we have no way to know what the application requires, but we should allow being able to configure it.

Initially this commit allows specifying the name of a role created elsewhere. I suspect though that it might be incredibly useful to be able to define which resources your application needs in waypoint.hcl, and have a role created with those permissions (maybe with a syntax similar to the Terraform aws_iam_policy_document data source[3]).

I've renamed the RoleName to ExecutionRoleName to make explicit what these roles are for.

[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html
[2] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html
[3] https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document

In ECS, there are two concepts for IAM roles: the execution role[1],
that allows AWS to make API calls on your behalf, to do things like pull
images from ECR and write logs to CloudWatch; and the task role[2], that
allows the containers within your task access to whatever resources you
need them to.

Given we almost always need the execution role, it makes sense to have
this created by default if it isn't specified.

The task role should not be created by default since we have no way to
know what the application requires, but we should allow being able to
configure it.

Initially this commit allows specifying the name of a role created
elsewhere. I suspect though that it might be incredibly useful to be
able to define which resources your application needs in `waypoint.hcl`,
and have a role created with those permissions (maybe with a syntax
similar to the Terraform `aws_iam_policy_document` data source[3]).

I've renamed the RoleName to ExecutionRoleName to make explicit what
these roles are for.

[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html
[2] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html
[3] https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document
@evanphx evanphx merged commit 5bbb60e into hashicorp:main Oct 28, 2020
@surminus surminus mentioned this pull request Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants