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

claudia destroy ignores --profile #100

Closed
kdybicz opened this issue Feb 12, 2017 · 6 comments
Closed

claudia destroy ignores --profile #100

kdybicz opened this issue Feb 12, 2017 · 6 comments
Assignees
Labels

Comments

@kdybicz
Copy link
Contributor

kdybicz commented Feb 12, 2017

  • Expected behaviour:

I would assume that claudia destroy --profile private will cleanup all changes introduced by Claudia. This in my case includes removing Lambda function, all installed notification handlers, role and policies.

  • What actually happens:

Unfortunately it's failing, because the --profile part seems to be ignored on https://github.com/claudiajs/claudia/blob/master/src/commands/destroy.js#L30 level and default profile is used. Which leads to situation where Lambda is properly removed, but roles and policies remain intact. I believe that there is also no code for notification handler/s removal.

AWS_PROFILE=private claudia destroy seems to be temporary workaround for that issue.

  • Link to a minimal, executable project that demonstrates the problem:

Any project where different AWS profile than default is in use. I'm trying to use Claudia here: https://github.com/secretescapes/aws-lambda-image/tree/claudia-to-rule-them-all.

  • Steps to install the project:

Clone that branch and replace private profile (in the package.json) with one that should be used. Be sure that default profile is invalid or to restrictive to allow Claudia to work properly.

Then just run npm run create.

  • Steps to reproduce the problem:

npm destroy

@linshu
Copy link

linshu commented Feb 14, 2017

I am having the same problem.

@gojko
Copy link
Member

gojko commented Feb 14, 2017

the most likely cause is this line

iam = new aws.IAM();
where IAM is initialised during module load instead of when the function is called. I should be able to patch and retest this soon.

@gojko gojko added the bug label Feb 14, 2017
@gojko gojko self-assigned this Feb 14, 2017
@linshu
Copy link

linshu commented Feb 15, 2017

You might need consider destroy a lambda which is created with an existing role (using --role option). I got this error while I destroyed a lambda with an existing role.

SJCMACD951FD56:rds_sns slin$ AWS_PROFILE=claudia claudia destroy
{ [DeleteConflict: Cannot delete entity, must detach all policies first.]
  message: 'Cannot delete entity, must detach all policies first.',
  code: 'DeleteConflict',
  time: Tue Feb 14 2017 13:24:18 GMT-0800 (PST),
  requestId: 'f1844792-f2fb-11e6-90ce-5d24be813fc8',
  statusCode: 409,
  retryable: false,
  retryDelay: 97.95927084051073 }

@kdybicz
Copy link
Contributor Author

kdybicz commented Feb 15, 2017

@linshu that's my bad. The actual working workaround is AWS_PROFILE=private claudia destroy --profile private. That one should also work for you.

@gojko gojko closed this as completed in f1124d3 Feb 17, 2017
@kdybicz
Copy link
Contributor Author

kdybicz commented Feb 17, 2017

👍

@gojko
Copy link
Member

gojko commented Feb 18, 2017

this is now on NPM as 2.8.0

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

No branches or pull requests

3 participants