Skip to content

Commit 47b6791

Browse files
committed
Adding depends_on
1 parent b114d70 commit 47b6791

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

main.tf

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ resource "aws_s3_bucket" "this" {
9393
resource "aws_s3_bucket_acl" "this" {
9494
bucket = aws_s3_bucket.this.id
9595
acl = "private"
96+
depends_on = [
97+
aws_s3_bucket.this
98+
]
9699
}
97100

98101
resource "aws_s3_bucket_ownership_controls" "this" {
@@ -101,6 +104,10 @@ resource "aws_s3_bucket_ownership_controls" "this" {
101104
rule {
102105
object_ownership = "BucketOwnerEnforced"
103106
}
107+
depends_on = [
108+
aws_s3_bucket.this,
109+
aws_s3_bucket_acl.this
110+
]
104111
}
105112

106113
resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
@@ -111,6 +118,11 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
111118
sse_algorithm = "AES256"
112119
}
113120
}
121+
depends_on = [
122+
aws_s3_bucket.this,
123+
aws_s3_bucket_acl.this,
124+
aws_s3_bucket_ownership_controls.this
125+
]
114126
}
115127

116128
resource "aws_s3_bucket_website_configuration" "this" {
@@ -121,15 +133,25 @@ resource "aws_s3_bucket_website_configuration" "this" {
121133
error_document {
122134
key = "error.html"
123135
}
136+
depends_on = [
137+
aws_s3_bucket.this,
138+
aws_s3_bucket_acl.this,
139+
aws_s3_bucket_ownership_controls.this,
140+
aws_s3_bucket_server_side_encryption_configuration.this
141+
]
124142

125143
}
126144

127145
resource "aws_s3_bucket_policy" "this" {
128146
bucket = aws_s3_bucket.this.id
129147
policy = data.aws_iam_policy_document.s3_this.json
130-
148+
131149
depends_on = [
132-
aws_s3_bucket.this
150+
aws_s3_bucket.this,
151+
aws_s3_bucket_acl.this,
152+
aws_s3_bucket_ownership_controls.this,
153+
aws_s3_bucket_server_side_encryption_configuration.this,
154+
aws_s3_bucket_website_configuration.this
133155
]
134156
}
135157

@@ -139,10 +161,14 @@ resource "aws_s3_bucket_public_access_block" "this" {
139161
block_public_policy = true
140162
ignore_public_acls = true
141163
restrict_public_buckets = true
142-
164+
143165
depends_on = [
144-
aws_s3_bucket_policy.this,
166+
aws_s3_bucket.this,
145167
aws_s3_bucket_acl.this,
168+
aws_s3_bucket_ownership_controls.this,
169+
aws_s3_bucket_server_side_encryption_configuration.this,
170+
aws_s3_bucket_website_configuration.this,
171+
aws_s3_bucket_policy.this
146172
]
147173
}
148174

0 commit comments

Comments
 (0)