-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to TF 0.12. Add tests. Add Codefresh test pipeline (#17)
* Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline
- Loading branch information
Showing
25 changed files
with
816 additions
and
191 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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
version: '1.0' | ||
|
||
stages: | ||
- Prepare | ||
- Test | ||
|
||
steps: | ||
wait: | ||
title: Wait | ||
stage: Prepare | ||
image: codefresh/cli:latest | ||
commands: | ||
- codefresh get builds --pipeline=${{CF_REPO_NAME}} --status running --limit 1000 -o json | jq --arg id ${{CF_BUILD_ID}} -ser 'flatten|.[-1].id==$id' | ||
retry: | ||
maxAttempts: 10 | ||
delay: 20 | ||
exponentialFactor: 1.1 | ||
|
||
main_clone: | ||
title: "Clone repository" | ||
type: git-clone | ||
stage: Prepare | ||
description: "Initialize" | ||
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} | ||
git: CF-default | ||
revision: ${{CF_REVISION}} | ||
|
||
clean_init: | ||
title: Prepare build-harness and test-harness | ||
image: ${{TEST_IMAGE}} | ||
stage: Prepare | ||
commands: | ||
- cf_export PATH="/usr/local/terraform/0.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
- make init | ||
- git -C build-harness checkout master | ||
- make -C test/ clean init TEST_HARNESS_BRANCH=master | ||
- make -C test/src clean init | ||
- find . -type d -name '.terraform' | xargs rm -rf | ||
- find . -type f -name 'terraform.tfstate*' -exec rm -f {} \; | ||
|
||
test: | ||
type: "parallel" | ||
title: "Run tests" | ||
description: "Run all tests in parallel" | ||
stage: Test | ||
steps: | ||
test_readme_lint: | ||
title: "Test README.md updated" | ||
stage: "Test" | ||
image: ${{TEST_IMAGE}} | ||
description: Test "readme/lint" | ||
commands: | ||
- make readme/lint | ||
|
||
test_module: | ||
title: Test module with bats | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ module | ||
|
||
test_examples_complete: | ||
title: Test "examples/complete" with bats | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ examples/complete | ||
|
||
test_examples_complete_terratest: | ||
title: Test "examples/complete" with terratest | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/src |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
region = "us-east-2" | ||
|
||
availability_zones = ["us-east-2a", "us-east-2b"] | ||
|
||
namespace = "eg" | ||
|
||
stage = "test" | ||
|
||
name = "vpc-peering" | ||
|
||
requestor_vpc_cidr = "172.16.0.0/16" | ||
|
||
acceptor_vpc_cidr = "172.32.0.0/16" |
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,70 @@ | ||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
module "requestor_vpc" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1" | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = concat(var.attributes, ["requestor"]) | ||
cidr_block = var.requestor_vpc_cidr | ||
tags = var.tags | ||
} | ||
|
||
module "requestor_subnets" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.18.1" | ||
availability_zones = var.availability_zones | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = concat(var.attributes, ["requestor"]) | ||
vpc_id = module.requestor_vpc.vpc_id | ||
igw_id = module.requestor_vpc.igw_id | ||
cidr_block = module.requestor_vpc.vpc_cidr_block | ||
nat_gateway_enabled = false | ||
nat_instance_enabled = false | ||
tags = var.tags | ||
} | ||
|
||
module "acceptor_vpc" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1" | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = concat(var.attributes, ["acceptor"]) | ||
cidr_block = var.acceptor_vpc_cidr | ||
tags = var.tags | ||
} | ||
|
||
module "acceptor_subnets" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.18.1" | ||
availability_zones = var.availability_zones | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = concat(var.attributes, ["acceptor"]) | ||
vpc_id = module.acceptor_vpc.vpc_id | ||
igw_id = module.acceptor_vpc.igw_id | ||
cidr_block = module.acceptor_vpc.vpc_cidr_block | ||
nat_gateway_enabled = false | ||
nat_instance_enabled = false | ||
tags = var.tags | ||
} | ||
|
||
module "vpc_peering" { | ||
source = "../.." | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = var.attributes | ||
tags = var.tags | ||
auto_accept = true | ||
requestor_allow_remote_vpc_dns_resolution = true | ||
acceptor_allow_remote_vpc_dns_resolution = true | ||
requestor_vpc_id = module.requestor_vpc.vpc_id | ||
acceptor_vpc_id = module.acceptor_vpc.vpc_id | ||
create_timeout = "5m" | ||
update_timeout = "5m" | ||
delete_timeout = "10m" | ||
} |
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,39 @@ | ||
output "requestor_vpc_cidr" { | ||
value = module.requestor_vpc.vpc_cidr_block | ||
description = "Requestor VPC ID" | ||
} | ||
|
||
output "requestor_public_subnet_cidrs" { | ||
value = module.requestor_subnets.public_subnet_cidrs | ||
description = "Requestor public subnet CIDRs" | ||
} | ||
|
||
output "requestor_private_subnet_cidrs" { | ||
value = module.requestor_subnets.private_subnet_cidrs | ||
description = "Requestor private subnet CIDRs" | ||
} | ||
|
||
output "acceptor_vpc_cidr" { | ||
value = module.acceptor_vpc.vpc_cidr_block | ||
description = "Acceptor VPC ID" | ||
} | ||
|
||
output "acceptor_public_subnet_cidrs" { | ||
value = module.acceptor_subnets.public_subnet_cidrs | ||
description = "Acceptor public subnet CIDRs" | ||
} | ||
|
||
output "acceptor_private_subnet_cidrs" { | ||
value = module.acceptor_subnets.private_subnet_cidrs | ||
description = "Acceptor private subnet CIDRs" | ||
} | ||
|
||
output "connection_id" { | ||
value = module.vpc_peering.connection_id | ||
description = "VPC peering connection ID" | ||
} | ||
|
||
output "accept_status" { | ||
value = module.vpc_peering.accept_status | ||
description = "The status of the VPC peering connection request" | ||
} |
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,52 @@ | ||
variable "region" { | ||
type = string | ||
description = "AWS Region" | ||
} | ||
|
||
variable "availability_zones" { | ||
type = list(string) | ||
description = "List of availability zones" | ||
} | ||
|
||
variable "namespace" { | ||
type = string | ||
description = "Namespace, which could be your organization name, e.g. 'eg' or 'cp'" | ||
} | ||
|
||
variable "stage" { | ||
type = string | ||
description = "Stage, e.g. 'prod', 'staging', 'dev' or 'testing'" | ||
} | ||
|
||
variable "name" { | ||
type = string | ||
description = "Solution name, e.g. 'app' or 'cluster'" | ||
} | ||
|
||
variable "delimiter" { | ||
type = string | ||
default = "-" | ||
description = "Delimiter to be used between `name`, `namespace`, `stage`, etc." | ||
} | ||
|
||
variable "attributes" { | ||
type = list(string) | ||
default = [] | ||
description = "Additional attributes (e.g. `1`)" | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
default = {} | ||
description = "Additional tags (e.g. `map('BusinessUnit`,`XYZ`)" | ||
} | ||
|
||
variable "requestor_vpc_cidr" { | ||
type = string | ||
description = "Requestor VPC CIDR" | ||
} | ||
|
||
variable "acceptor_vpc_cidr" { | ||
type = string | ||
description = "Acceptor VPC CIDR" | ||
} |
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,9 @@ | ||
terraform { | ||
required_version = "~> 0.12.0" | ||
|
||
required_providers { | ||
aws = "~> 2.0" | ||
template = "~> 2.0" | ||
local = "~> 1.3" | ||
} | ||
} |
Oops, something went wrong.