Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for ECS Secrets #663

Merged
merged 3 commits into from
Nov 19, 2018
Merged

Conversation

PettitWesley
Copy link
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@PettitWesley
Copy link
Contributor Author

@SoManyHs @allisaurus

Regarding the mock changes, I ran make generate using the latest version of mockgen. When I run make generate multiple times on the code, there is no additional diff, so these changes seems to be stable. I suspect that mockgen has rejiggered how they create mocks a little bit, and that's why there's some extra changes. There's nothing weird with the license or year anymore though.

@PettitWesley
Copy link
Contributor Author

PettitWesley commented Nov 16, 2018

Testing:

ECS Params file:

version: 1
task_definition:
  task_execution_role: ecsExecutionRole
  services:
    redis:
      secrets:
        - value_from: /mysecrets/dbpassword
          name: DB_PASSWORD
        - value_from: /mysecrets/dbusername
          name: DB_USERNAME
$ ecs-cli compose create
INFO[0000] Using ECS task definition                     TaskDefinition="secrets:1"

Results in this task def (only key fields are shown):

{
  "executionRoleArn": "arn:aws:iam::111111111111:role/ecsExecutionRole",
  "containerDefinitions": [
    {
      "linuxParameters": {
        "capabilities": {
          "add": null,
          "drop": null
        },
      },
      "secrets": [
        {
          "valueFrom": "/mysecrets/dbpassword",
          "name": "DB_PASSWORD"
        },
        {
          "valueFrom": "/mysecrets/dbusername",
          "name": "DB_USERNAME"
        }
      ],
      "image": "redis:latest",
      "essential": true,
      "name": "redis"
    }
  ],
  "taskDefinitionArn": "arn:aws:ecs:us-west-2:144718711470:task-definition/secrets:1",
  "family": "secrets",
  "requiresAttributes": [
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "ecs.capability.secrets.ssm.environment-variables"
    }
  ],
  "requiresCompatibilities": [
    "EC2"
  ],
  "revision": 1,
  "status": "ACTIVE",
}

Copy link
Contributor

@SoManyHs SoManyHs left a comment

Choose a reason for hiding this comment

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

Can you also include updates to the README?

credentials_parameter: arn:aws:secretsmanager:1234567890:secret:test-RT4iv`
credentials_parameter: arn:aws:secretsmanager:1234567890:secret:test-RT4iv
secrets:
- value_from: /mysecrets/dbpassword
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you not going to make one of these an ARN just for purposes of documentation through tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, will do!

@PettitWesley PettitWesley merged commit ea6a554 into aws:dev Nov 19, 2018
@PettitWesley PettitWesley deleted the ecs-secrets-public branch November 19, 2018 08:32
@ryandev421
Copy link

This doesn't work on fargate with following error.

The specified platform does not satisfy the task definition’s required capabilities.

@ajchida
Copy link

ajchida commented Nov 28, 2018

@ryanpark91
"Important
This feature is not yet supported for tasks using the Fargate launch type."

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html

This feature is not supported on fargate (yet)

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

Successfully merging this pull request may close these issues.

4 participants