diff --git a/README.md b/README.md
index 1d7249d..a14de34 100644
--- a/README.md
+++ b/README.md
@@ -224,6 +224,7 @@ Available targets:
| Name | Source | Version |
|------|--------|---------|
+| [artifact\_store\_bucket](#module\_artifact\_store\_bucket) | cloudposse/s3-bucket/aws | 0.49.0 |
| [codebuild](#module\_codebuild) | cloudposse/codebuild/aws | 0.37.1 |
| [codebuild\_label](#module\_codebuild\_label) | cloudposse/label/null | 0.25.0 |
| [codepipeline\_assume\_role\_label](#module\_codepipeline\_assume\_role\_label) | cloudposse/label/null | 0.25.0 |
@@ -250,7 +251,6 @@ Available targets:
| [aws_iam_role_policy_attachment.codestar](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
-| [aws_s3_bucket.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [random_string.webhook_secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
| [aws_caller_identity.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
diff --git a/docs/terraform.md b/docs/terraform.md
index 83f4d16..d0adc31 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -20,6 +20,7 @@
| Name | Source | Version |
|------|--------|---------|
+| [artifact\_store\_bucket](#module\_artifact\_store\_bucket) | cloudposse/s3-bucket/aws | 0.49.0 |
| [codebuild](#module\_codebuild) | cloudposse/codebuild/aws | 0.37.1 |
| [codebuild\_label](#module\_codebuild\_label) | cloudposse/label/null | 0.25.0 |
| [codepipeline\_assume\_role\_label](#module\_codepipeline\_assume\_role\_label) | cloudposse/label/null | 0.25.0 |
@@ -46,7 +47,6 @@
| [aws_iam_role_policy_attachment.codestar](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
-| [aws_s3_bucket.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [random_string.webhook_secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
| [aws_caller_identity.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
diff --git a/main.tf b/main.tf
index aafa3dd..4c11e3f 100644
--- a/main.tf
+++ b/main.tf
@@ -6,9 +6,12 @@ module "codepipeline_label" {
context = module.this.context
}
-resource "aws_s3_bucket" "default" {
+module "artifact_store_bucket" {
+ source = "cloudposse/s3-bucket/aws"
+ version = "0.49.0"
+
count = module.this.enabled ? 1 : 0
- bucket = module.codepipeline_label.id
+ bucket_name = module.codepipeline_label.id
acl = "private"
force_destroy = var.s3_bucket_force_destroy
tags = module.codepipeline_label.tags
@@ -114,8 +117,8 @@ data "aws_iam_policy_document" "s3" {
]
resources = [
- join("", aws_s3_bucket.default.*.arn),
- "${join("", aws_s3_bucket.default.*.arn)}/*"
+ join("", module.artifact_store_bucket.*.bucket_arn),
+ "${join("", module.artifact_store_bucket.*.bucket_arn)}/*"
]
effect = "Allow"
@@ -246,7 +249,7 @@ resource "aws_codepipeline" "default" {
role_arn = join("", aws_iam_role.default.*.arn)
artifact_store {
- location = join("", aws_s3_bucket.default.*.bucket)
+ location = join("", module.artifact_store_bucket.*.bucket_arn)
type = "S3"
}
@@ -328,7 +331,7 @@ resource "aws_codepipeline" "bitbucket" {
role_arn = join("", aws_iam_role.default.*.arn)
artifact_store {
- location = join("", aws_s3_bucket.default.*.bucket)
+ location = join("", module.artifact_store_bucket.*.bucket_arn)
type = "S3"
}