-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix broken name tag * Do not set name for default * use Localstack action
- Loading branch information
Showing
9 changed files
with
195 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,9 @@ jobs: | |
sudo mv /tmp/terraform /usr/local/bin/ | ||
- name: Start Localstack | ||
run: docker-compose up -d | ||
uses: LocalStack/[email protected] | ||
with: | ||
image-tag: "latest" | ||
|
||
- name: Terratest | ||
env: | ||
|
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,45 @@ | ||
# Setting a Custom Name Tag for the Peering Connection | ||
|
||
This is a basic configuration example, which creates a peering connection between VPCs in a single region within the same AWS account. | ||
|
||
However, here we set a custom name tag for the peering connection using the `name` variable. | ||
|
||
**Notice**: You need to declare both providers even with single region peering. | ||
|
||
## Code Sample | ||
|
||
```hcl | ||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
module "single_account_single_region" { | ||
source = "../../" | ||
providers = { | ||
aws.this = aws | ||
aws.peer = aws | ||
} | ||
name = "prod-external" | ||
this_vpc_id = var.this_vpc_id | ||
peer_vpc_id = var.peer_vpc_id | ||
auto_accept_peering = true | ||
tags = { | ||
Environment = "Test" | ||
} | ||
} | ||
``` | ||
|
||
## Usage | ||
|
||
Change the variables to fit your purposes and run: | ||
|
||
```bash | ||
terraform init | ||
terraform plan | ||
terraform apply | ||
``` |
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,23 @@ | ||
// Basic Module Example | ||
// Creates a peering between VPCs in the same account in the same region | ||
module "custiom_name" { | ||
source = "../../" | ||
|
||
providers = { | ||
aws.this = aws | ||
aws.peer = aws | ||
} | ||
|
||
// Required for tests | ||
name = var.name | ||
|
||
this_vpc_id = var.this_vpc_id | ||
peer_vpc_id = var.peer_vpc_id | ||
|
||
auto_accept_peering = true | ||
|
||
tags = { | ||
Name = "tf-single-account-single-region" | ||
Environment = "Test" | ||
} | ||
} |
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,8 @@ | ||
// Required for tests | ||
output "vpc_peering_accept_status" { | ||
value = module.custiom_name.vpc_peering_accept_status | ||
} | ||
|
||
output "vpc_peering_connection" { | ||
value = module.custiom_name.aws_vpc_peering_connection | ||
} |
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,15 @@ | ||
// This provider example is designed to work with Localstack. | ||
// You need to have a real AWS provider configuration for the production usage. | ||
provider "aws" { | ||
endpoints { | ||
ec2 = "http://localhost:4566" | ||
s3 = "http://localhost:4566" | ||
sts = "http://localhost:4566" | ||
} | ||
region = "eu-west-1" | ||
access_key = "null" | ||
secret_key = "null" | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
} |
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,15 @@ | ||
// Variables are required to pass them via Terratest | ||
// on fixtures creation | ||
variable "this_vpc_id" { | ||
type = string | ||
} | ||
|
||
variable "peer_vpc_id" { | ||
type = string | ||
} | ||
|
||
variable "name" { | ||
description = "Name of the VPC Peering Connection" | ||
default = "" | ||
type = string | ||
} |
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
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