From 17efa3558392590a4c1d7f351d04bbb34dc14030 Mon Sep 17 00:00:00 2001 From: mrbean Date: Tue, 19 Jan 2021 21:53:34 -0500 Subject: [PATCH 1/2] do not override source --- README.md | 8 ++++---- iam-source.tf | 8 ++++---- main.tf | 8 ++++---- s3-dest.tf | 2 +- s3-source.tf | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5c2b7b8..cee026c 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Terraform Module for managing s3 bucket cross-account cross-region replication. - Terraform 0.11 module provider inheritance block: -- `aws.source` - AWS provider alias for source account -- `aws.dest` - AWS provider alias for destination account +- `source_of_replication` - AWS provider alias for source account +- `aws.destination_of_replication` - AWS provider alias for destination account #### Optional @@ -47,8 +47,8 @@ module "s3-cross-account-replication" { replication_name = "my-replication-name" providers { - "aws.source" = "aws.source" - "aws.dest" = "aws.dest" + "source_of_replication" = "source_of_replication" + "aws.destination_of_replication" = "aws.destination_of_replication" } } diff --git a/iam-source.tf b/iam-source.tf index 2d2339a..4ee9dc5 100644 --- a/iam-source.tf +++ b/iam-source.tf @@ -37,25 +37,25 @@ data "aws_iam_policy_document" "source_write" { } resource "aws_iam_policy" "source_write" { - provider = aws.source + provider = aws.source_of_replication name_prefix = "${local.replication_name}-source-write-" policy = data.aws_iam_policy_document.source_write.json } resource "aws_iam_user" "source_write" { - provider = aws.source + provider = aws.source_of_replication name = "${local.replication_name}-source-write-user" force_destroy = true } resource "aws_iam_user_policy_attachment" "source_write" { - provider = aws.source + provider = aws.source_of_replication user = aws_iam_user.source_write.name policy_arn = aws_iam_policy.source_write.arn } resource "aws_iam_access_key" "source_write" { - provider = aws.source + provider = aws.source_of_replication user = aws_iam_user.source_write.name } diff --git a/main.tf b/main.tf index 394c5b0..e1cf43b 100644 --- a/main.tf +++ b/main.tf @@ -1,18 +1,18 @@ # MAIN provider "aws" { - alias = "source" + alias = "source_of_replication" } provider "aws" { - alias = "dest" + alias = "destination_of_replication" } data "aws_caller_identity" "source" { - provider = aws.source + provider = aws.source_of_replication } data "aws_caller_identity" "dest" { - provider = aws.dest + provider = aws.destination_of_replication } diff --git a/s3-dest.tf b/s3-dest.tf index 58d3334..c11ecce 100644 --- a/s3-dest.tf +++ b/s3-dest.tf @@ -42,7 +42,7 @@ data "aws_iam_policy_document" "dest_bucket_policy" { resource "aws_s3_bucket" "dest" { count = var.create_dest_bucket == "true" ? 1 : 0 - provider = aws.dest + provider = aws.destination_of_replication bucket = var.dest_bucket_name region = var.dest_region policy = data.aws_iam_policy_document.dest_bucket_policy.json diff --git a/s3-source.tf b/s3-source.tf index 23e6808..c2d595c 100644 --- a/s3-source.tf +++ b/s3-source.tf @@ -74,19 +74,19 @@ data "aws_iam_policy_document" "source_replication_policy" { } resource "aws_iam_role" "source_replication" { - provider = aws.source + provider = aws.source_of_replication name = "${local.replication_name}-replication-role" assume_role_policy = data.aws_iam_policy_document.source_replication_role.json } resource "aws_iam_policy" "source_replication" { - provider = aws.source + provider = aws.source_of_replication name = "${local.replication_name}-replication-policy" policy = data.aws_iam_policy_document.source_replication_policy.json } resource "aws_iam_role_policy_attachment" "source_replication" { - provider = aws.source + provider = aws.source_of_replication role = aws_iam_role.source_replication.name policy_arn = aws_iam_policy.source_replication.arn } @@ -94,7 +94,7 @@ resource "aws_iam_role_policy_attachment" "source_replication" { # S3 source bucket resource "aws_s3_bucket" "source" { - provider = aws.source + provider = aws.source_of_replication bucket = var.source_bucket_name region = var.source_region From 51bc98340dbcd3376f65c482e8cd92765727a8c0 Mon Sep 17 00:00:00 2001 From: mrbean Date: Tue, 19 Jan 2021 22:01:00 -0500 Subject: [PATCH 2/2] correct readme --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cee026c..222b56f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Terraform Module for managing s3 bucket cross-account cross-region replication. - Terraform 0.11 module provider inheritance block: -- `source_of_replication` - AWS provider alias for source account +- `aws.source_of_replication` - AWS provider alias for source account - `aws.destination_of_replication` - AWS provider alias for destination account #### Optional @@ -47,7 +47,7 @@ module "s3-cross-account-replication" { replication_name = "my-replication-name" providers { - "source_of_replication" = "source_of_replication" + "aws.source_of_replication" = "source_of_replication" "aws.destination_of_replication" = "aws.destination_of_replication" } } @@ -81,7 +81,11 @@ Authors Changelog ========= -1.0.0 - Initial release. +1.0.0 - Initial release + +2.0.0 - TF 0.12.X + +3.0.0 - Rename povider License =======