Skip to content

Commit

Permalink
Fix aws provider bug in vpc-peering
Browse files Browse the repository at this point in the history
  • Loading branch information
posquit0 committed Dec 3, 2023
1 parent d74edf6 commit 20dd808
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/vpc-peering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ This module creates following resources.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.29.0 |
| <a name="provider_aws.accepter"></a> [aws.accepter](#provider\_aws.accepter) | 5.29.0 |
| <a name="provider_aws.requester"></a> [aws.requester](#provider\_aws.requester) | 5.29.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_resource_group"></a> [resource\_group](#module\_resource\_group) | tedilabs/misc/aws//modules/resource-group | ~> 0.10.0 |
| <a name="module_resource_group_accepter"></a> [resource\_group\_accepter](#module\_resource\_group\_accepter) | tedilabs/misc/aws//modules/resource-group | ~> 0.10.0 |
| <a name="module_resource_group_requester"></a> [resource\_group\_requester](#module\_resource\_group\_requester) | tedilabs/misc/aws//modules/resource-group | ~> 0.10.0 |

## Resources

Expand Down
6 changes: 4 additions & 2 deletions modules/vpc-peering/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ provider "aws" {
}

data "aws_caller_identity" "requester" {
provider = aws.accepter
provider = aws.requester
}

data "aws_caller_identity" "accepter" {
provider = aws.accepter
}

data "aws_region" "requester" {
provider = aws.accepter
provider = aws.requester
}

data "aws_region" "accepter" {
Expand Down Expand Up @@ -123,5 +123,7 @@ resource "aws_vpc_peering_connection_options" "accepter" {
}

data "aws_vpc_peering_connection" "this" {
provider = aws.accepter

id = aws_vpc_peering_connection_accepter.this.id
}
30 changes: 29 additions & 1 deletion modules/vpc-peering/resource-group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,38 @@ locals {
}


module "resource_group" {
module "resource_group_requester" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"

providers = {
aws = aws.requester
}

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description

query = {
resource_tags = local.module_tags
}

module_tags_enabled = false
tags = merge(
local.module_tags,
var.tags,
)
}

module "resource_group_accepter" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"

providers = {
aws = aws.accepter
}

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
Expand Down

0 comments on commit 20dd808

Please sign in to comment.