From 90a4cf5d85037cd4bc1f68776e8f7d0cbe17581b Mon Sep 17 00:00:00 2001 From: alt Date: Sun, 24 May 2020 13:56:52 +0200 Subject: [PATCH 1/3] Add support for AWS_DEFAULT_REGION --- templates/restic_access_Linux.j2 | 3 +++ templates/restic_script_Linux.j2 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/templates/restic_access_Linux.j2 b/templates/restic_access_Linux.j2 index 724c7ca..9195dc7 100644 --- a/templates/restic_access_Linux.j2 +++ b/templates/restic_access_Linux.j2 @@ -11,6 +11,9 @@ AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} {% if restic_repos[item.repo].aws_secret_access_key is defined %} AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} {% endif %} +{% if restic_repos[item.repo].aws_default_region is defined %} +AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} +{% endif %} BACKUP_NAME={{ item.name }} {% if item.src is defined %} BACKUP_SOURCE={{ item.src }} diff --git a/templates/restic_script_Linux.j2 b/templates/restic_script_Linux.j2 index afae5cb..327f12c 100644 --- a/templates/restic_script_Linux.j2 +++ b/templates/restic_script_Linux.j2 @@ -12,6 +12,9 @@ AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} {% if restic_repos[item.repo].aws_secret_access_key is defined %} AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} {% endif %} +{% if restic_repos[item.repo].aws_default_region is defined %} +AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} +{% endif %} {% if item.src is defined %} BACKUP_SOURCE={{ item.src }} {% endif %} From 75ad299fb7ec00ce1039c2b117cdee7f61837260 Mon Sep 17 00:00:00 2001 From: alt Date: Sun, 24 May 2020 15:13:26 +0200 Subject: [PATCH 2/3] Export S3 vars --- templates/restic_access_Linux.j2 | 6 +++--- templates/restic_script_Linux.j2 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/restic_access_Linux.j2 b/templates/restic_access_Linux.j2 index 9195dc7..8c52cdc 100644 --- a/templates/restic_access_Linux.j2 +++ b/templates/restic_access_Linux.j2 @@ -6,13 +6,13 @@ export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} export RESTIC_PASSWORD={{ restic_repos[item.repo].password }} {% if restic_repos[item.repo].aws_access_key is defined %} -AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} +export AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} {% endif %} {% if restic_repos[item.repo].aws_secret_access_key is defined %} -AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} +export AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} {% endif %} {% if restic_repos[item.repo].aws_default_region is defined %} -AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} +export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} {% endif %} BACKUP_NAME={{ item.name }} {% if item.src is defined %} diff --git a/templates/restic_script_Linux.j2 b/templates/restic_script_Linux.j2 index 327f12c..8374200 100644 --- a/templates/restic_script_Linux.j2 +++ b/templates/restic_script_Linux.j2 @@ -7,13 +7,13 @@ export RESTIC_REPOSITORY={{ restic_repos[item.repo].location }} export RESTIC_PASSWORD={{ restic_repos[item.repo].password }} BACKUP_NAME={{ item.name }} {% if restic_repos[item.repo].aws_access_key is defined %} -AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} +export AWS_ACCESS_KEY_ID={{ restic_repos[item.repo].aws_access_key }} {% endif %} {% if restic_repos[item.repo].aws_secret_access_key is defined %} -AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} +export AWS_SECRET_ACCESS_KEY={{ restic_repos[item.repo].aws_secret_access_key }} {% endif %} {% if restic_repos[item.repo].aws_default_region is defined %} -AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} +export AWS_DEFAULT_REGION={{ restic_repos[item.repo].aws_default_region }} {% endif %} {% if item.src is defined %} BACKUP_SOURCE={{ item.src }} From 7a58f17857fd5495f63416ac1a6ef4253312b84e Mon Sep 17 00:00:00 2001 From: alt4 Date: Mon, 25 May 2020 01:37:40 +0200 Subject: [PATCH 3/3] Add aws_default_region to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7f2ff6c..ae2a811 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ Available variables: | `init` | no | Describes if the repository should be initialized or not. Use `false` if you are backuping to an already existing repo. | | `aws_access_key` | no | The access key for the S3 backend | | `aws_secret_access_key` | no | The secret access key for the S3 backend | +| `aws_default_region` | no | The desired region for the S3 backend | Example: ```yaml