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

ecs deploy fails #790

Closed
aruntomar opened this issue Nov 12, 2020 · 7 comments · Fixed by #824
Closed

ecs deploy fails #790

aruntomar opened this issue Nov 12, 2020 · 7 comments · Fixed by #824
Labels
bug Something isn't working plugin/aws
Milestone

Comments

@aruntomar
Copy link

aruntomar commented Nov 12, 2020

Describe the bug
Deploying to ECS fails with the following error.

» Deploying...
✓ Created new ECS cluster: waypoint
✓ Created IAM role: ecr-example-nodejs
❌ IAM role not found:
! InvalidParameter: 1 validation error(s) found.
  - minimum field size of 1, GetRoleInput.RoleName.

Steps to Reproduce
I'm using the waypoint-example app
https://github.com/hashicorp/waypoint-examples/blob/main/aws-ecs/nodejs/waypoint.hcl

Expected behavior
Application gets deployed on ECS

Additional context
If i add a specific role_name as the doc then i get the following error

waypoint-examples/aws-ecs/nodejs/waypoint.hcl:24,7-16:
  Unsupported argument; An argument named "role_name" is not expected here.
deploy {
    use "aws-ecs" {
      region = "ca-central-1"
      memory = "512"
      role_name = "ecr-example-nodejs"
    }
  }
waypoint version
Waypoint v0.1.5 (084d8603)
@krantzinator
Copy link
Contributor

The variable name should be execution_role_name, which I'll update our documentation to reflect. You can also use task_role_name to assign a task IAM role; I'll add that to the documentation as well.
Thanks for bringing this up!

@krantzinator krantzinator added the documentation Improvements or additions to documentation label Nov 12, 2020
@krantzinator krantzinator added the bug Something isn't working label Nov 12, 2020
@philippelegaldeloitte
Copy link

philippelegaldeloitte commented Nov 13, 2020

Hello @krantzinator ,
I am experiencing the same issue as @aruntomar.

  deploy {
    use "aws-ecs" {
      region = "eu-central-1"
      memory = "512"
    }
  }
}

yields :

» Deploying...
✓ Found existing ECS cluster: waypoint
⠙ Found existing IAM role to use: ecr-example-nodejs
! InvalidParameter: 1 validation error(s) found.
  - minimum field size of 1, GetRoleInput.RoleName.

same using :

[execution_role_name = "ecr-example-nodejs" in]:

deploy {
    use "aws-ecs" {
      region = "eu-central-1"
      memory = "512"
      execution_role_name = "ecr-example-nodejs"
    }
  }

Is there a fix or a work around ?

Thanks

@aruntomar
Copy link
Author

@philippelegaldeloitte @krantzinator
I think task_role_name is a required variable 🤔

I tried these in sequence.

  1. Add execution_role_name - FAILS ❌
  2. Use both execution_role_name & task_role_name - SUCCESS ✅
  3. Only use task_role_name - SUCCESS ✅

@krantzinator
Copy link
Contributor

Thanks for sharing your workaround! We likely need to update the handling of task_role_name to also auto-create a role if one is not specified, which is how execution_role_name is handled. We can include this in the next release.

@krantzinator krantzinator added plugin/aws and removed documentation Improvements or additions to documentation labels Nov 13, 2020
@krantzinator krantzinator added this to the 0.1.6 milestone Nov 13, 2020
@philippelegaldeloitte
Copy link

Hi @aruntomar and @krantzinator,

deploy { use "aws-ecs" { region = "eu-central-1" memory = "512" execution_role_name = "ecr-example-nodejs" task_role_name = "ecr-example-nodejs" } }

deployed successfully to aws-ecs.

Note that, at the moment, the 2 variables execution_role_name and task_role_name are indicated as optional

@surminus
Copy link
Contributor

I added the PR that introduced this behaviour, and both should definitely be optional (with the execution role created automatically if not provided). Probably needs a conditional here and when defining the task definition.

Given I introduced this bug I feel compelled to fix it so will look at whipping up a PR :)

surminus added a commit to surminus/waypoint that referenced this issue Nov 19, 2020
The `execution_role_name` is optional, but this is a required parameter,
so is automatically created if it's left blank.

Setting `task_role_name` should also be optional, but since this is not
required it isn't created automatically, and should not be referenced in
the task definition if it's not set.

Fixes issue: hashicorp#790
@krantzinator krantzinator linked a pull request Nov 19, 2020 that will close this issue
krantzinator added a commit that referenced this issue Nov 19, 2020
Fix ECS task role name bug (issue #790)
@krmayankk
Copy link

just ran into the same issue, specifying task_role_name = "ecr-example-nodejs" resolved it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working plugin/aws
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants