-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Using mfa_delete on an S3 bucket #629
Comments
I think |
Is this simply because only the root account can enable MFA delete? |
The problem still exists with enabling MFA_Delete on an S3 bucket even if you execute |
The underlying command Therefore Terraform needs to ask for the token code while applying. It can't ask beforehand as the token code may be already invalid (TOTP is time-based). |
since mfa_delete can't be enabled via Terraform at this moment. hashicorp/terraform-provider-aws#629
According to @apparentlymart here:
aws-mfa looks like a promising, pretty-much-automated way of solving this, but I haven't been able to get it to work with this issue yet. I tried both with and without root account keys, and both with a credentials profile and by passing the creds (including AWS_SESSION_TOKEN) in as environment variables - but the same error persists:
|
The link above to the S3 Go SDK is pointing to a line that doesn't seem relevant, so I assume that file has just changed a bunch since that comment. I think the intent was to link to the This argument becomes the special HTTP header I don't know why this particular API is designed in this unusual way; I'd guess it's probably an API analog of the usual MFA setup UI where you are requested to enter your token once during setup to prove that you've got your MFA device set up properly before you potentially lock yourself out, which is separate than then using the MFA process once it's activated. Indeed it does seem like the Terraform AWS provider would need to do something special to make this work. As I noted in my other comment, we don't consider Terraform to be an interactive tool in general and so introducing extra interactive input in the apply phase is not ideal. Probably the best we could do in the short term is to expose an additional argument on the resource that calls this endpoint that takes the TOTP code and then have the user pass it in as a variable, but as noted in an earlier comment that's problematic if you are doing a separate plan/apply since the token will probably have expired by the time you get to the apply stage. Given that MFA setup is generally an interactive process anyway, it could potentially be argued that it's not a good fit for Terraform, but if we can find a way to support it without adding a lot of complexity then that'd definitely be nice. If not, perhaps we could just find and document a suitable workflow for doing that particular change interactively via the AWS console without Terraform trying to revert it back to off again on the next run. |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @Techbrunch as hashicorp/terraform#12973. It was migrated here as part of the provider split. The original body of the issue is below.
How to enable
mfa_delete
on an s3 bucket ?Terraform Version
Terraform v0.9.1
Affected Resource(s)
Terraform Configuration Files
Debug Output
The text was updated successfully, but these errors were encountered: