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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 Terraformaws_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