Skip to content

Commit 4ad0d80

Browse files
tenyoTenyo Grozev
and
Tenyo Grozev
authored
allow overriding storage encryption (#21)
Co-authored-by: Tenyo Grozev <[email protected]>
1 parent 2a96827 commit 4ad0d80

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

actions/orchestration.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
2727
if req.Cluster != nil {
2828
req.Cluster.Tags = normalizeTags(req.Cluster.Tags)
2929

30+
// set default storage encryption
31+
if req.Cluster.StorageEncrypted == nil {
32+
req.Cluster.StorageEncrypted = aws.Bool(true)
33+
}
34+
3035
// set default subnet group
3136
if req.Cluster.DBSubnetGroupName == nil {
3237
req.Cluster.DBSubnetGroupName = aws.String(o.client.DefaultSubnetGroup)
@@ -62,7 +67,7 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
6267
MasterUserPassword: req.Cluster.MasterUserPassword,
6368
MasterUsername: req.Cluster.MasterUsername,
6469
Port: req.Cluster.Port,
65-
StorageEncrypted: aws.Bool(true),
70+
StorageEncrypted: req.Cluster.StorageEncrypted,
6671
Tags: toRDSTags(req.Cluster.Tags),
6772
VpcSecurityGroupIds: req.Cluster.VpcSecurityGroupIds,
6873
}
@@ -89,6 +94,11 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
8994
if req.Instance != nil {
9095
req.Instance.Tags = normalizeTags(req.Instance.Tags)
9196

97+
// set default storage encryption
98+
if req.Instance.StorageEncrypted == nil {
99+
req.Instance.StorageEncrypted = aws.Bool(true)
100+
}
101+
92102
// set default subnet group
93103
if req.Instance.DBSubnetGroupName == nil {
94104
req.Instance.DBSubnetGroupName = aws.String(o.client.DefaultSubnetGroup)
@@ -126,7 +136,7 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
126136
MultiAZ: req.Instance.MultiAZ,
127137
Port: req.Instance.Port,
128138
PubliclyAccessible: aws.Bool(false),
129-
StorageEncrypted: aws.Bool(true),
139+
StorageEncrypted: req.Instance.StorageEncrypted,
130140
Tags: toRDSTags(req.Instance.Tags),
131141
VpcSecurityGroupIds: req.Instance.VpcSecurityGroupIds,
132142
}

actions/types.go

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type CreateDBInstanceInput struct {
3535
MasterUsername *string
3636
MultiAZ *bool
3737
Port *int64
38+
StorageEncrypted *bool
3839
Tags []*Tag
3940
VpcSecurityGroupIds []*string
4041
}
@@ -55,6 +56,7 @@ type CreateDBClusterInput struct {
5556
Port *int64
5657
ScalingConfiguration *ScalingConfiguration
5758
SnapshotIdentifier *string
59+
StorageEncrypted *bool
5860
Tags []*Tag
5961
VpcSecurityGroupIds []*string
6062
}

0 commit comments

Comments
 (0)