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

[back-357] add ECS service, IAM, & definition modules #36

Merged
merged 11 commits into from
Nov 3, 2020

Conversation

jpetto
Copy link
Contributor

@jpetto jpetto commented Oct 30, 2020

Goal

add ECS service, IAM, and container definition modules.

this work has been validated through the following:

  • npm run build && npm run synth
  • cd cdktf.out
  • terraform init
  • terraform validate

i haven't yet tested all this work against our dev infra (but i have been testing along the way and fixing some issues).

imo, the "worst" part about using this ECS module will be passing in and testing the role policy statements for ECS IAM. (these will be a part of the consuming project).

one other thing that's getting a bit hairy is the size of the config objects, as we need to pass in and down quite a bit of info from the entry point into sub-modules (e.g. ECSService > ECSIAM and ECSService > ECSContainerDefinition). an alternative would be to have these all top-level modules that are configured separately and combined within ECSService. might be a point to discuss.

Todos

  • test terraform plan and terraform apply against our dev infra

Reference

Tickets:

Implementation Decisions

attempted to abstract/make configurable as much as practical at this time. i'm sure there will be changes to what is configurable going forward.

@jpetto jpetto requested a review from a team as a code owner October 30, 2020 15:48
@jpetto jpetto force-pushed the back-357-complete-ecs-service-module branch 2 times, most recently from 01e08c5 to 90ee018 Compare October 30, 2020 16:25
@jpetto jpetto force-pushed the back-357-complete-ecs-service-module branch from 90ee018 to e0314b0 Compare October 30, 2020 16:30
Copy link
Member

@bassrock bassrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 1 step closer to worrying only about business logic.!!

Just had a few non-blocking comments.

const secretEnvVarsValue = config.secretEnvVars
? JSON.stringify(config.secretEnvVars)
: 'null';
const commandValue = config.command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the amazon docs say what to put if we don't want to override this? or does an existing task definition provide an example? Just want to make sure an empty string means don't override.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked and it's an optional param. updating to remove it from the JSON if no command is configured.


new ApplicationECSIAM(stack, 'testECSService', BASE_CONFIG);

expect(Testing.synth(stack)).toMatchSnapshot();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this so much.


//create ecs service
new EcsService(this, 'ecs-service', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need to reference this elsewhere, can you make it public on the class

new ApplicationECSService(this, 'ecs_service', {
prefix: config.prefix,
name: config.alb6CharacterPrefix,
ecsCluster: '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should actually be able to use ApplicationECSCluster and create it before this :D

- make ecs service public
- remove command from container def if none passed in
- update snapshots
@bassrock bassrock requested a review from izo3 November 3, 2020 00:03
@kkyeboah kkyeboah merged commit d7a6872 into main Nov 3, 2020
@kkyeboah kkyeboah deleted the back-357-complete-ecs-service-module branch November 3, 2020 16:55
@pocket-ci
Copy link

🎉 This PR is included in version 1.3.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants