fargatecli
fargatecli copied to clipboard
Create default SG for Task Run and Service Create
Issue #, if available:
- Fargate CLI currently does not check if the default security groups exist. It polls for the
fargate-defaultsecurity group. For fresh AWS accounts, there is no such SG. This results in anilbeing returned. The CLI continues down this path to register the task/service with the SG, resulting in the following error message - To reproduce this error, go to the AWS Console -> EC2> Security groups. If
fargate-defaultis available, select it and remove it. - In a terminal window, do the following:
> fargate task run web --image nginx:latest -v
...
[!] Could not run ECS task
InvalidParameterException: security group cannot be blank.
status code: 400, request id: ce47d313-0784-4dfa-8c1b-f359f02693b0
Description of changes:
- Added
SetDefaultSecurityGroupID()call to check for default security groups for run task and create service. - Run task and create service creates default security group if default security group does not exist.
- Similar function in
vpc_operation.gois refactored into EC2 client and shared withservice_create.goandtask_run.go. - Added console logs in EC2 client, service_create.go, task_run.go.
- Unit tests for refactored code. Increased EC2 module code coverage by 10%.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.