Skip to content

Commit

Permalink
fix: Pin version to v3 due to number of breaking changes in v4 (#136)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Babenko <[email protected]>
  • Loading branch information
bryantbiggs and antonbabenko authored Feb 10, 2022
1 parent 3ca2f30 commit 7dd9a65
Show file tree
Hide file tree
Showing 23 changed files with 120 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc

*.zip
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.62.3
rev: v1.64.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ inputs = {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.69 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.69 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.69 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.69 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.69 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.60 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.69 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
12 changes: 12 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
provider "aws" {
region = local.region

# Make it faster by skipping something
skip_get_ec2_platforms = true
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}

locals {
bucket_name = "s3-bucket-${random_pet.this.id}"
region = "eu-west-1"
}

data "aws_canonical_user_id" "current" {}
Expand Down
10 changes: 8 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.60"
random = ">= 2.0"
aws = {
source = "hashicorp/aws"
version = "~> 3.69"
}
random = {
source = "hashicorp/random"
version = ">= 2.0"
}
}
}
1 change: 0 additions & 1 deletion examples/notification/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions examples/notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.50 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.69 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.50 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.69 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

Expand Down
12 changes: 12 additions & 0 deletions examples/notification/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
provider "aws" {
region = local.region

# Make it faster by skipping something
skip_get_ec2_platforms = true
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}

locals {
bucket_name = "s3-bucket-${random_pet.this.id}"
region = "eu-west-1"
}

resource "random_pet" "this" {
Expand Down
15 changes: 12 additions & 3 deletions examples/notification/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.50"
random = ">= 2.0"
null = ">= 2.0"
aws = {
source = "hashicorp/aws"
version = "~> 3.69"
}
random = {
source = "hashicorp/random"
version = ">= 2.0"
}
null = {
source = "hashicorp/null"
version = ">= 2.0"
}
}
}
1 change: 0 additions & 1 deletion examples/object/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions examples/object/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.50 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.69 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.50 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.69 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
6 changes: 5 additions & 1 deletion examples/object/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "aws" {
region = "eu-west-1"
region = local.region

# Make it faster by skipping something
skip_get_ec2_platforms = true
Expand All @@ -9,6 +9,10 @@ provider "aws" {
skip_requesting_account_id = true
}

locals {
region = "eu-west-1"
}

module "object" {
source = "../../modules/object"

Expand Down
10 changes: 8 additions & 2 deletions examples/object/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.50"
random = ">= 2.0"
aws = {
source = "hashicorp/aws"
version = "~> 3.69"
}
random = {
source = "hashicorp/random"
version = ">= 2.0"
}
}
}
6 changes: 3 additions & 3 deletions examples/s3-replication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.69 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.69 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.69 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | >= 3.69 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.69 |
| <a name="provider_aws.replica"></a> [aws.replica](#provider\_aws.replica) | ~> 3.69 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand Down
28 changes: 21 additions & 7 deletions examples/s3-replication/main.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
locals {
bucket_name = "origin-s3-bucket-${random_pet.this.id}"
destination_bucket_name = "replica-s3-bucket-${random_pet.this.id}"
origin_region = "eu-west-1"
replica_region = "eu-central-1"
}

provider "aws" {
region = local.origin_region

# Make it faster by skipping something
skip_get_ec2_platforms = true
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}

provider "aws" {
region = local.replica_region

alias = "replica"

# Make it faster by skipping something
skip_get_ec2_platforms = true
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true
}

locals {
bucket_name = "origin-s3-bucket-${random_pet.this.id}"
destination_bucket_name = "replica-s3-bucket-${random_pet.this.id}"
origin_region = "eu-west-1"
replica_region = "eu-central-1"
}

data "aws_caller_identity" "current" {}
Expand Down
10 changes: 8 additions & 2 deletions examples/s3-replication/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.69"
random = ">= 2.0"
aws = {
source = "hashicorp/aws"
version = "~> 3.69"
}
random = {
source = "hashicorp/random"
version = ">= 2.0"
}
}
}
4 changes: 2 additions & 2 deletions modules/notification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Creates S3 bucket notification resource with all supported types of deliveries:
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.28 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.28 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.28 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.28 |

## Modules

Expand Down
8 changes: 4 additions & 4 deletions modules/notification/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ data "aws_arn" "queue" {
}

data "aws_iam_policy_document" "sqs" {
for_each = var.create_sqs_policy ? var.sqs_notifications : tomap({})
for_each = { for k, v in var.sqs_notifications : k => v if var.create_sqs_policy }

statement {
sid = "AllowSQSS3BucketNotification"
Expand All @@ -102,15 +102,15 @@ data "aws_iam_policy_document" "sqs" {
}

resource "aws_sqs_queue_policy" "allow" {
for_each = var.create_sqs_policy ? var.sqs_notifications : tomap({})
for_each = { for k, v in var.sqs_notifications : k => v if var.create_sqs_policy }

queue_url = lookup(each.value, "queue_id", lookup(local.queue_ids, each.key, null))
policy = data.aws_iam_policy_document.sqs[each.key].json
}

# SNS Topic
data "aws_iam_policy_document" "sns" {
for_each = var.create_sns_policy ? var.sns_notifications : tomap({})
for_each = { for k, v in var.sns_notifications : k => v if var.create_sns_policy }

statement {
sid = "AllowSNSS3BucketNotification"
Expand All @@ -137,7 +137,7 @@ data "aws_iam_policy_document" "sns" {
}

resource "aws_sns_topic_policy" "allow" {
for_each = var.create_sns_policy ? var.sns_notifications : tomap({})
for_each = { for k, v in var.sns_notifications : k => v if var.create_sns_policy }

arn = each.value.topic_arn
policy = data.aws_iam_policy_document.sns[each.key].json
Expand Down
5 changes: 4 additions & 1 deletion modules/notification/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.28"
aws = {
source = "hashicorp/aws"
version = "~> 3.28"
}
}
}
4 changes: 2 additions & 2 deletions modules/object/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Creates S3 bucket objects with different configurations.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.36 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.36 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.36 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.36 |

## Modules

Expand Down
5 changes: 4 additions & 1 deletion modules/object/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.36"
aws = {
source = "hashicorp/aws"
version = "~> 3.36"
}
}
}
5 changes: 4 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ terraform {
required_version = ">= 0.13.1"

required_providers {
aws = ">= 3.69"
aws = {
source = "hashicorp/aws"
version = "~> 3.69"
}
}
}

0 comments on commit 7dd9a65

Please sign in to comment.