Skip to content

Commit

Permalink
Add import block for s3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Nov 13, 2023
1 parent ece5d97 commit 834d9ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions terraform/modules/networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ resource "aws_route" "private_nat_gateway" {

// Add the routes to the route tables
resource "aws_route_table_association" "public" {
count = length(aws_subnet.public_subnets)
count = var.num_public_subnets
subnet_id = element(aws_subnet.public_subnets.*.id, count.index)
route_table_id = aws_route_table.public.id
}
resource "aws_route_table_association" "private" {
count = length(aws_subnet.private_subnets)
count = var.num_private_subnets
subnet_id = element(aws_subnet.private_subnets.*.id, count.index)
route_table_id = aws_route_table.private.id
}
Expand Down
5 changes: 5 additions & 0 deletions terraform/modules/storage/s3-private/bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ resource "aws_s3_bucket" "bucket" {
}
}

import {
to = aws_s3_bucket.bucket
id = "${var.domain}-${var.service_name}-${var.environment}"
}

# Block all public access
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block
resource "aws_s3_bucket_public_access_block" "access_block" {
Expand Down

0 comments on commit 834d9ef

Please sign in to comment.