@@ -80,25 +80,17 @@ module "security_group" {
80
80
tags = local. tags
81
81
}
82
82
83
- # Temporary work around until S3 module is updated to support v4.x
84
- resource "aws_s3_bucket" "import" {
83
+ module "import_s3_bucket" {
84
+ source = " terraform-aws-modules/s3-bucket/aws"
85
+ version = " ~> 3.0"
86
+
85
87
bucket = " ${ local . name } -${ random_pet . this . id } "
88
+ acl = " private"
86
89
force_destroy = true
87
90
88
91
tags = local. tags
89
92
}
90
93
91
- # module "import_s3_bucket" {
92
- # source = "terraform-aws-modules/s3-bucket/aws"
93
- # version = "~> 2.0"
94
-
95
- # bucket = "${local.name}-${random_pet.this.id}"
96
- # acl = "private"
97
- # force_destroy = true
98
-
99
- # tags = local.tags
100
- # }
101
-
102
94
data "aws_iam_policy_document" "s3_import_assume" {
103
95
statement {
104
96
actions = [
@@ -129,7 +121,7 @@ data "aws_iam_policy_document" "s3_import" {
129
121
]
130
122
131
123
resources = [
132
- aws_s3_bucket . import . arn
124
+ module . import_s3_bucket . s3_bucket_arn
133
125
]
134
126
}
135
127
@@ -139,7 +131,7 @@ data "aws_iam_policy_document" "s3_import" {
139
131
]
140
132
141
133
resources = [
142
- " ${ aws_s3_bucket . import . arn } /*" ,
134
+ " ${ module . import_s3_bucket . s3_bucket_arn } /*" ,
143
135
]
144
136
}
145
137
}
@@ -153,7 +145,7 @@ resource "aws_iam_role_policy" "s3_import" {
153
145
# also needs this role so this is an easy way of ensuring the backup is uploaded before
154
146
# the instance creation starts
155
147
provisioner "local-exec" {
156
- command = " unzip backup.zip && aws s3 sync ${ path . module } /backup s3://${ aws_s3_bucket . import . id } "
148
+ command = " unzip backup.zip && aws s3 sync ${ path . module } /backup s3://${ module . import_s3_bucket . s3_bucket_id } "
157
149
}
158
150
}
159
151
@@ -168,7 +160,7 @@ module "db" {
168
160
169
161
# All available versions: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt
170
162
engine = " mysql"
171
- engine_version = " 8.0.27 "
163
+ engine_version = " 8.0.28 "
172
164
family = " mysql8.0" # DB parameter group
173
165
major_engine_version = " 8.0" # DB option group
174
166
instance_class = " db.t4g.large"
@@ -182,13 +174,13 @@ module "db" {
182
174
183
175
# S3 import https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.html
184
176
s3_import = {
185
- source_engine_version = " 8.0.27 "
186
- bucket_name = aws_s3_bucket.import.id
177
+ source_engine_version = " 8.0.28 "
178
+ bucket_name = module.import_s3_bucket.s3_bucket_id
187
179
ingestion_role = aws_iam_role.s3_import.arn
188
180
}
189
181
190
182
multi_az = true
191
- subnet_ids = module. vpc . database_subnets
183
+ db_subnet_group_name = module. vpc . database_subnet_group_name
192
184
vpc_security_group_ids = [module . security_group . security_group_id ]
193
185
194
186
maintenance_window = " Mon:00:00-Mon:03:00"
0 commit comments