Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# S3
$aws_access_key = $::backup::params::aws_access_key,
$aws_secret_key = $::backup::params::aws_secret_key,
$use_iam_profile = $::backup::params::use_iam_profile,
$bucket = $::backup::params::bucket,
$aws_region = $::backup::params::aws_region,
# Remote storage common
Expand Down
17 changes: 11 additions & 6 deletions manifests/job.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
# S3
$aws_access_key = $::backup::aws_access_key,
$aws_secret_key = $::backup::aws_secret_key,
$use_iam_profile = $::backup::use_iam_profile,
$bucket = $::backup::bucket,
$aws_region = $::backup::aws_region,
$reduced_redundancy = $::backup::reduced_redundancy,
Expand Down Expand Up @@ -195,13 +196,16 @@
# S3
if $storage_type == 's3' {
validate_bool($reduced_redundancy)
validate_bool($use_iam_profile)

if !$use_iam_profile {
if !$aws_access_key or !is_string($aws_access_key) {
fail("[Backup::Job::${name}]: Parameter aws_access_key is required for S3 storage")
}

if !$aws_access_key or !is_string($aws_access_key) {
fail("[Backup::Job::${name}]: Parameter aws_access_key is required for S3 storage")
}

if !$aws_secret_key or !is_string($aws_secret_key) {
fail("[Backup::Job::${name}]: Parameter aws_secret_key is required for S3 storage")
if !$aws_secret_key or !is_string($aws_secret_key) {
fail("[Backup::Job::${name}]: Parameter aws_secret_key is required for S3 storage")
}
}

if !$bucket or !is_string($bucket) {
Expand Down Expand Up @@ -456,6 +460,7 @@
# Template uses
# - $aws_access_key
# - $aws_secret_key
# - $use_iam_profile
# - $path
# - $aws_region
# - $bucket
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
# S3
$aws_access_key = undef
$aws_secret_key = undef
$use_iam_profile = false
$bucket = undef
$aws_region = undef
$reduced_redundancy = false
Expand Down
6 changes: 5 additions & 1 deletion templates/job/s3.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
# Amazon Simple Storage Service [Storage]
#
store_with S3 do |s3|
<% if @use_iam_profile -%>
s3.use_iam_profile = true
<% else -%>
s3.access_key_id = "<%= @aws_access_key -%>"
s3.secret_access_key = "<%= @aws_secret_key -%>"
<% end -%>
s3.path = "<%= @_path -%>"
s3.bucket = "<%= @bucket -%>"
<% if @aws_region -%>
Expand All @@ -14,5 +18,5 @@
<% end -%>
<% if @reduced_redundancy -%>
s3.storage_class = :reduced_redundancy
<% end -%>
<% end %>
end