-
-
Notifications
You must be signed in to change notification settings - Fork 37
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 (#9)
* Convert to TF 0.12. Add Security Group rules * Convert to TF 0.12. Add Security Group rules * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline * Convert to TF 0.12. Add Security Group rules. Add tests. Add CodeFresh test pipeline
- Loading branch information
Showing
23 changed files
with
1,110 additions
and
215 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 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,77 @@ | ||
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: | ||
- unset AWS_PROFILE | ||
- unset AWS_DEFAULT_PROFILE | ||
- unset AWS_MFA_PROFILE | ||
- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| alarm_actions | Alarm actions | list | `<list>` | no | | ||
| alarm_cpu_threshold_percent | CPU threshold alarm level | string | `75` | no | | ||
| alarm_memory_threshold_bytes | Alarm memory threshold bytes | string | `10000000` | no | | ||
| apply_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | string | `true` | no | | ||
| availability_zones | List of Availability Zones where subnets will be created | list | - | yes | | ||
| cluster_size | Cluster size | string | `1` | no | | ||
| engine_version | Engine version | string | `1.4.33` | no | | ||
| instance_type | Elastic cache instance type | string | `t2.micro` | no | | ||
| alarm_actions | Alarm actions | list(string) | `<list>` | no | | ||
| alarm_cpu_threshold_percent | CPU threshold alarm level | number | `75` | no | | ||
| alarm_memory_threshold_bytes | Alarm memory threshold bytes | number | `10000000` | no | | ||
| allowed_cidr_blocks | List of CIDR blocks that are allowed ingress to the cluster's Security Group created in the module | list(string) | `<list>` | no | | ||
| allowed_security_groups | List of Security Group IDs that are allowed ingress to the cluster's Security Group created in the module | list(string) | `<list>` | no | | ||
| apply_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | bool | `true` | no | | ||
| attributes | Additional attributes (_e.g._ "1") | list(string) | `<list>` | no | | ||
| availability_zones | List of Availability Zones for the cluster | list(string) | - | yes | | ||
| cluster_size | Cluster size | number | `1` | no | | ||
| delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no | | ||
| elasticache_parameter_group_family | ElastiCache parameter group family | string | `memcached1.5` | no | | ||
| elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no | | ||
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no | | ||
| engine_version | Memcached engine version. For more info, see https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/supported-engine-versions.html | string | `1.5.16` | no | | ||
| existing_security_groups | List of existing Security Group IDs to place the cluster into. Set `use_existing_security_groups` to `true` to enable using `existing_security_groups` as Security Groups for the cluster | list(string) | `<list>` | no | | ||
| instance_type | Elastic cache instance type | string | `cache.t2.micro` | no | | ||
| maintenance_window | Maintenance window | string | `wed:03:00-wed:04:00` | no | | ||
| max_item_size | Max item size | string | `10485760` | no | | ||
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | - | yes | | ||
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | | ||
| max_item_size | Max item size | number | `10485760` | no | | ||
| name | Name of the application | string | - | yes | | ||
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no | | ||
| notification_topic_arn | Notification topic arn | string | `` | no | | ||
| security_groups | AWS security group ids | list | - | yes | | ||
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | | ||
| subnets | AWS subnet ids | list | `<list>` | no | | ||
| port | Memcached port | number | `11211` | no | | ||
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no | | ||
| subnets | AWS subnet ids | list(string) | `<list>` | no | | ||
| tags | Additional tags (_e.g._ map("BusinessUnit","ABC") | map(string) | `<map>` | no | | ||
| use_existing_security_groups | Flag to enable/disable creation of Security Group in the module. Set to `true` to disable Security Group creation and provide a list of existing security Group IDs in `existing_security_groups` to place the cluster into | bool | `false` | no | | ||
| vpc_id | VPC ID | string | `` | no | | ||
| zone_id | Route53 DNS Zone id | string | `` | no | | ||
| zone_id | Route53 DNS Zone ID | string | `` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| config_host | Config host | | ||
| hosts | Hosts | | ||
| id | Disambiguated ID | | ||
| port | Port | | ||
| security_group_id | Security group id | | ||
| cluster_address | Cluster address | | ||
| cluster_configuration_endpoint | Cluster configuration endpoint | | ||
| cluster_id | Cluster ID | | ||
| cluster_urls | Cluster URLs | | ||
| hostname | Cluster hostname | | ||
| security_group_id | Security Group ID | | ||
|
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,18 @@ | ||
region = "us-east-2" | ||
|
||
availability_zones = ["us-east-2a", "us-east-2b"] | ||
|
||
namespace = "eg" | ||
|
||
stage = "test" | ||
|
||
name = "memcached-test" | ||
|
||
instance_type = "cache.t2.micro" | ||
|
||
cluster_size = 1 | ||
|
||
# https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/supported-engine-versions.html | ||
engine_version = "1.5.16" | ||
|
||
elasticache_parameter_group_family = "memcached1.5" |
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,40 @@ | ||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
module "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 | ||
cidr_block = "172.16.0.0/16" | ||
} | ||
|
||
module "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 | ||
vpc_id = module.vpc.vpc_id | ||
igw_id = module.vpc.igw_id | ||
cidr_block = module.vpc.vpc_cidr_block | ||
nat_gateway_enabled = false | ||
nat_instance_enabled = false | ||
} | ||
|
||
module "memcached" { | ||
source = "../../" | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
availability_zones = var.availability_zones | ||
vpc_id = module.vpc.vpc_id | ||
allowed_security_groups = [module.vpc.vpc_default_security_group_id] | ||
subnets = module.subnets.private_subnet_ids | ||
cluster_size = var.cluster_size | ||
instance_type = var.instance_type | ||
engine_version = var.engine_version | ||
apply_immediately = true | ||
zone_id = var.zone_id | ||
} |
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,44 @@ | ||
output "public_subnet_cidrs" { | ||
value = module.subnets.public_subnet_cidrs | ||
description = "Public subnet CIDRs" | ||
} | ||
|
||
output "private_subnet_cidrs" { | ||
value = module.subnets.private_subnet_cidrs | ||
description = "Private subnet CIDRs" | ||
} | ||
|
||
output "vpc_cidr" { | ||
value = module.vpc.vpc_cidr_block | ||
description = "VPC CIDR" | ||
} | ||
|
||
output "cluster_id" { | ||
value = module.memcached.cluster_id | ||
description = "Cluster ID" | ||
} | ||
|
||
output "security_group_id" { | ||
value = module.memcached.security_group_id | ||
description = "Security Group ID" | ||
} | ||
|
||
output "cluster_address" { | ||
value = module.memcached.cluster_address | ||
description = "Cluster address" | ||
} | ||
|
||
output "cluster_configuration_endpoint" { | ||
value = module.memcached.cluster_configuration_endpoint | ||
description = "Cluster configuration endpoint" | ||
} | ||
|
||
output "hostname" { | ||
value = module.memcached.hostname | ||
description = "Cluster hostname" | ||
} | ||
|
||
output "cluster_urls" { | ||
value = module.memcached.cluster_urls | ||
description = "Cluster URLs" | ||
} |
Oops, something went wrong.