generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: import the resources for BI Extracts
- Import the s3 bucket that was created to store Cost and Usage Report 2.0 data - Update TF Plan actions to handle imports
- Loading branch information
1 parent
049793c
commit e3ba09d
Showing
5 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
module "cur_export_bucket" { | ||
source = "github.com/cds-snc/terraform-modules//S3?ref=v9.0.5" | ||
billing_tag_value = "SRE" | ||
} | ||
|
||
import { | ||
to = module.cur_export_bucket.aws_s3_bucket.this | ||
id = "713f18dd-9f30-4976-a152-e81d48cf053a" | ||
} | ||
|
||
resource "aws_s3_bucket_policy" "cur_export_bucket" { | ||
bucket = module.cur_export_bucket.s3_bucket_id | ||
policy = data.aws_iam_policy_document.cur_export_bucket.json | ||
|
||
} | ||
|
||
import { | ||
to = aws_s3_bucket_policy.cur_export_bucket | ||
id = "713f18dd-9f30-4976-a152-e81d48cf053a" | ||
} | ||
|
||
data "aws_iam_policy_document" "cur_export_bucket" { | ||
statement { | ||
sid = "EnableAWSDataExportsToWriteToS3AndCheckPolicy" | ||
effect = "Allow" | ||
actions = ["s3:PutObject", "s3:GetBucketPolicy"] | ||
resources = [ | ||
module.cur_export_bucket.s3_bucket_arn, | ||
"${module.cur_export_bucket.s3_bucket_arn}/*" | ||
] | ||
principals { | ||
type = "Service" | ||
identifiers = ["bcm-data-exports.amazonaws.com", "billingreports.amazonaws.com"] | ||
} | ||
condition { | ||
test = "StringLike" | ||
variable = "aws:SourceArn" | ||
values = [ | ||
"arn:aws:cur:us-east-1:659087519042:definition/*", | ||
"arn:aws:bcm-data-exports:us-east-1:659087519042:export/*" | ||
] | ||
} | ||
condition { | ||
test = "StringEquals" | ||
variable = "aws:SourceAccount" | ||
values = ["659087519042"] | ||
} | ||
} | ||
|
||
statement { | ||
sid = "CDSSupersetRootRead" | ||
effect = "Allow" | ||
actions = [ | ||
"s3:GetBucketLocation", | ||
"s3:GetObject", | ||
"s3:ListBucket", | ||
"s3:ListBucketMultipartUploads", | ||
"s3:ListMultipartUploadParts", | ||
"s3:AbortMultipartUpload" | ||
] | ||
resources = [ | ||
module.cur_export_bucket.s3_bucket_arn, | ||
"${module.cur_export_bucket.s3_bucket_arn}/*" | ||
] | ||
principals { | ||
type = "AWS" | ||
identifiers = ["arn:aws:iam::066023111852:root"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
|