-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Is there no support for explicitly defining access_key and secret_key in terragrunt backend configuration? #732
Comments
Hi @kadenlnelson, This is a use case we haven't addressed yet: using the s3 backend with something that is not AWS. What is happening is that because you are using the I think there are two issues here:
I think the best way to address this is to enhance Note that any implementation should be held off until #731 merges, which addresses tf12 compatibility. |
Yes, I have successful S3 backend initialization with this method + with aws profiles using shared credentials file.
DO doesn't have managed NoSQL, but I don't think that Terragrunt auto-creates DynamoDB tables, though I'm not 100% sure If I have some free time I'd love to submit a PR, but if anyone else wants to crack at this, please help! 😢 |
Ah it looks like it only creates the table if So I think it should actually work as is against the DO endpoint, if you switch to using env vars. Is that not the case? Are you getting an error / is the bucket being created in AWS? Or do you have something in your environment that prevents you from using env vars and need to hard code the creds in the config? |
Yes, I have successful S3 backend initialization with this method + with aws profiles using shared credentials file. |
Lost several hours due to this because of unhelpful error messages "SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method." If there is no support for access_key and secret_key (and there is support in Terraform), it should ideally warn user that this is not supported and that env vars AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY needs to be used. I agree that it's not ideal to have secrets in the config but there may be cases for this, especially if Terraform itself supports it. But there may be cases where the credentials are already loaded in a variable from somewhere else. Similarly locking - it is a nice thing, but may not be necessary for smaller deployments with S3-compatible remote stores so please don't ignore S3-compatible stores just because there is no locking. |
We would love to address this, but we don't use anything other than S3 or GCS internally at Gruntwork and being a small team, it's hard for us to maintain and implement all the features for the different clouds. This doesn't mean that we don't want to support this, but it does mean that this is a lower priority for us to implement and need help from the community. FWIW, a workaround in newer versions of terragrunt would be to bypass the |
Thanks @yorinasub17 for a workaround, here is my working example:
generate "s3_backend" {
path = "s3_backend.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
backend "s3" {
bucket = "bucket-name"
key = "${path_relative_to_include()}/terraform.tfstate"
access_key = "access_key"
secret_key = "secret_key"
# it may be any valid aws region, it doesn't affect anything
region = "us-west-1"
# endpoint should match bucket's region
endpoint = "https://fra1.digitaloceanspaces.com"
skip_credentials_validation = true
skip_get_ec2_platforms = true
skip_requesting_account_id = true
skip_metadata_api_check = true
}
}
EOF
} |
My fix was that I had to add remote_state {
backend = "s3"
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
skip_metadata_api_check = true
skip_credentials_validation = true
endpoint = "https://nyc3.digitaloceanspaces.com"
region = "us-east-1"
bucket = "..."
key = "${path_relative_to_include()}/terraform.tfstate"
}
disable_init = true # here
} Otherwise when I do the following
I would get some weird questions that wouldn't work
|
haven't addressed yet? |
Just wanted to share that I've found it possible to use a proper Here's an example that works for me: remote_state {
backend = "s3"
generate = {
path = "backend.tf"
if_exists = "overwrite"
}
config = {
endpoint = "https://sfo3.digitaloceanspaces.com"
key = "${path_relative_to_include()}/terraform.tfstate"
bucket = "my-state-bucket"
region = "us-east-1"
# Disable AWS-specific options for Terraform
skip_credentials_validation = true
skip_metadata_api_check = true
# Disable AWS-specific options for Terragrunt
# https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#remote_state
skip_bucket_public_access_blocking = true
skip_bucket_ssencryption = true
skip_bucket_root_access = true
skip_bucket_enforced_tls = true
}
} |
I'm trying to define my access_key and secret_key explicitly as per the example below in the
.tfvars
file. But I'm receiving this error...[terragrunt] 2019/06/06 22:02:59 Error finding AWS credentials
Is this because Terragrunt uses the AWS library to find the credentials at the shared credentials file and environmental variables? I'm utilizing DigitalOcean spaces as an S3 compatible backend. Do I have to drink the AWS koolaid on this one?
The text was updated successfully, but these errors were encountered: