Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove deprecated 'template' provider #78

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,14 @@ See the [examples/](examples/) folder for more information.
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.2.5 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0.0 |
| <a name="requirement_template"></a> [template](#requirement\_template) | >= 2.0.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0.0 |
| <a name="provider_template"></a> [template](#provider\_template) | >= 2.0.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0.0 |

## Modules

Expand All @@ -240,7 +238,6 @@ No modules.
| [aws_s3_bucket_public_access_block.block_public_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [random_id.id](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
| [aws_iam_policy_document.irsa](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [template_file.bucket_policy](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |

## Inputs

Expand Down
11 changes: 3 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ resource "random_id" "id" {
#####################
# Generate policies #
#####################
# TODO: the `template` provider has been deprecated, these need to be removed in a future release.
data "template_file" "bucket_policy" {
template = var.bucket_policy

vars = {
bucket_arn = "arn:aws:s3:::${local.bucket_name}"
}
locals {
bucket_policy = replace(var.bucket_policy, "$${bucket_arn}", "arn:aws:s3:::${local.bucket_name}")
}

#################
Expand All @@ -46,7 +41,7 @@ resource "aws_s3_bucket" "bucket" {
bucket = local.bucket_name
acl = var.acl
force_destroy = "true"
policy = data.template_file.bucket_policy.rendered
policy = local.bucket_policy

dynamic "lifecycle_rule" {
for_each = var.lifecycle_rule
Expand Down
6 changes: 1 addition & 5 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ terraform {
}
random = {
source = "hashicorp/random"
version = ">= 2.0.0"
}
template = {
source = "hashicorp/template"
version = ">= 2.0.0"
version = ">= 3.0.0"
}
}
}