diff --git a/README.md b/README.md index bd19292..068064b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ kurgan add redshift | Encrypt | If true, the data in the cluster is encrypted at rest | | false | String | ['true', 'false'] | KmsKeyId | The AWS Key Management Service (KMS) key ID of the encryption key that you want to use to encrypt data in the cluster. | | | | | Snapshot | The name of the snapshot from which to create the new cluster | | false | String | +| SnapshotOwnerAccount |The AWS account used to create or copy the snapshot | | false | String | | DatabaseName | The name of the first database to be created when the cluster is created. | | false | String | ## Configuration diff --git a/redshift.cfhighlander.rb b/redshift.cfhighlander.rb index f784386..3e0b8b5 100644 --- a/redshift.cfhighlander.rb +++ b/redshift.cfhighlander.rb @@ -20,6 +20,7 @@ ComponentParam 'Encrypt', 'true', allowedValues: ['true', 'false'] ComponentParam 'KmsKeyId', '' ComponentParam 'Snapshot', '' + ComponentParam 'SnapshotOwnerAccount', '' ComponentParam 'DatabaseName', '' end diff --git a/redshift.cfndsl.rb b/redshift.cfndsl.rb index db0632e..f543aad 100644 --- a/redshift.cfndsl.rb +++ b/redshift.cfndsl.rb @@ -9,6 +9,7 @@ Condition(:RedshiftSingleNodeClusterCondition, FnEquals(Ref(:NumberOfNodes), '1')) Condition(:EnableLoggingCondition, FnEquals(Ref(:EnableLogging), 'true')) Condition(:SnapshotSet, FnNot(FnEquals(Ref(:Snapshot), ''))) + Condition(:OwnerAccountSet, FnNot(FnEquals(Ref(:SnapshotOwnerAccount), ''))) Condition(:DatabaseNameSet, FnNot(FnEquals(Ref(:DatabaseName), ''))) Condition(:EncryptWithKMS, FnAnd([ FnNot(FnEquals(Ref(:KmsKeyId), '')), @@ -146,6 +147,7 @@ ) IamRoles [FnGetAtt(:RedshiftIAMRole, :Arn)] SnapshotIdentifier FnIf(:SnapshotSet, Ref(:Snapshot), Ref('AWS::NoValue')) + OwnerAccount FnIf(:OwnerAccountSet, Ref(:SnapshotOwnerAccount), Ref('AWS::NoValue')) Tags redshift_tags } diff --git a/spec/default_spec.rb b/spec/default_spec.rb index 4bb9cca..b24bed8 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -248,6 +248,10 @@ expect(resource["Properties"]["SnapshotIdentifier"]).to eq({"Fn::If"=>["SnapshotSet", {"Ref"=>"Snapshot"}, {"Ref"=>"AWS::NoValue"}]}) end + it "to have property OwnerAccount" do + expect(resource["Properties"]["OwnerAccount"]).to eq({"Fn::If"=>["OwnerAccountSet", {"Ref"=>"SnapshotOwnerAccount"}, {"Ref"=>"AWS::NoValue"}]}) + end + it "to have property Tags" do expect(resource["Properties"]["Tags"]).to eq([{"Key"=>"Environment", "Value"=>{"Ref"=>"EnvironmentName"}}]) end diff --git a/spec/tags_spec.rb b/spec/tags_spec.rb index 98f41cf..2e5c0a9 100644 --- a/spec/tags_spec.rb +++ b/spec/tags_spec.rb @@ -247,6 +247,10 @@ it "to have property SnapshotIdentifier" do expect(resource["Properties"]["SnapshotIdentifier"]).to eq({"Fn::If"=>["SnapshotSet", {"Ref"=>"Snapshot"}, {"Ref"=>"AWS::NoValue"}]}) end + + it "to have property OwnerAccount" do + expect(resource["Properties"]["OwnerAccount"]).to eq({"Fn::If"=>["OwnerAccountSet", {"Ref"=>"SnapshotOwnerAccount"}, {"Ref"=>"AWS::NoValue"}]}) + end it "to have property Tags" do expect(resource["Properties"]["Tags"]).to eq([{"Key"=>"Environment", "Value"=>{"Ref"=>"EnvironmentName"}}, {"Key"=>"Locale", "Value"=>"AU"}])