diff --git a/main.tf b/main.tf index a76f83d..fa8e5b0 100644 --- a/main.tf +++ b/main.tf @@ -41,6 +41,12 @@ module "aws_data" { source = "./modules/aws_data" } +module "iam_module" { + source = "./modules/iam" + identifer = module.aws_data.random_number.result + repo-name = var.repo-name +} + module "s3_storage" { source = "terraform-aws-modules/s3-bucket/aws" diff --git a/modules/iam/main.tf b/modules/iam/main.tf new file mode 100644 index 0000000..eec7bea --- /dev/null +++ b/modules/iam/main.tf @@ -0,0 +1,31 @@ +## s3 backend bucket policy + +resource "aws_s3_bucket_policy" "backend-policy" { + bucket = "${var.repo-name}-backend-${var.identifer}" + policy = <