Skip to content

Commit f0e0845

Browse files
authored
Merge pull request #2 from clouddrove/CD-90
github action
2 parents e3a1d17 + 78fd411 commit f0e0845

File tree

10 files changed

+209
-110
lines changed

10 files changed

+209
-110
lines changed

.github/workflows/terraform.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: 'Terraform GitHub Actions'
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
terraform:
7+
name: 'Terraform'
8+
runs-on: ubuntu-latest
9+
steps:
10+
11+
- name: 'Checkout'
12+
uses: actions/checkout@master
13+
14+
- name: 'Terraform Format'
15+
uses: clouddrove/[email protected]
16+
with:
17+
actions_subcommand: 'fmt'
18+
19+
- name: 'Terraform Init for memcached'
20+
uses: clouddrove/[email protected]
21+
with:
22+
actions_subcommand: 'init'
23+
tf_actions_working_dir: ./_example/memcached
24+
25+
- name: 'Terraform Init Redis'
26+
uses: clouddrove/[email protected]
27+
with:
28+
actions_subcommand: 'init'
29+
tf_actions_working_dir: ./_example/redis
30+
31+
- name: 'Terraform Init For Redis Cluster'
32+
uses: clouddrove/[email protected]
33+
with:
34+
actions_subcommand: 'init'
35+
tf_actions_working_dir: ./_example/redis-cluster
36+
37+
- name: Configure AWS Credentials
38+
uses: clouddrove/configure-aws-credentials@v1
39+
with:
40+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
41+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42+
aws-region: us-east-2
43+
44+
- name: 'Terraform Plan for memcached'
45+
uses: clouddrove/[email protected]
46+
with:
47+
actions_subcommand: 'plan'
48+
tf_actions_working_dir: ./_example/memcached
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: 'Terraform Plan for Redis'
53+
uses: clouddrove/[email protected]
54+
with:
55+
actions_subcommand: 'plan'
56+
tf_actions_working_dir: ./_example/redis
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: 'Terraform Plan For Redis Cluster'
61+
uses: clouddrove/[email protected]
62+
with:
63+
actions_subcommand: 'plan'
64+
tf_actions_working_dir: ./_example/redis-cluster
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: 'Terratest For Memcached'
69+
uses: clouddrove/[email protected]
70+
with:
71+
actions_subcommand: 'terratest'
72+
tf_actions_working_dir: ./_test/memcached
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: 'Terratest For Redis'
77+
uses: clouddrove/[email protected]
78+
with:
79+
actions_subcommand: 'terratest'
80+
tf_actions_working_dir: ./_test/redis
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: 'Terratest For Redis Cluster'
85+
uses: clouddrove/[email protected]
86+
with:
87+
actions_subcommand: 'terratest'
88+
tf_actions_working_dir: ./_test/redis-cluster
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: 'Slack Notification'
93+
uses: clouddrove/action-slack@v2
94+
with:
95+
status: ${{ job.status }}
96+
fields: repo,author
97+
author_name: 'Clouddrove'
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
100+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
101+
if: always()

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ Here are some examples of how you can use this module in your inventory structur
7272
### Redis
7373
```hcl
7474
module "redis" {
75-
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.0"
75+
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.2"
7676
name = "redis"
77-
application = "cd"
77+
application = "clouddrove"
7878
environment = "test"
79-
label_order = ["environment", "name", "application"]
79+
label_order = ["environment", "application", "name"]
8080
engine = "redis"
8181
engine_version = "5.0.0"
8282
family = "redis5.0"
@@ -91,12 +91,12 @@ module "redis" {
9191
```
9292
### Redis Cluster
9393
```hcl
94-
module "s3_bucket" {
95-
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.0"
96-
name = "cluster"
97-
application = "cd"
94+
module "redis-cluster" {
95+
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.2"
96+
name = "cluster"
97+
application = "clouddrove"
9898
environment = "test"
99-
label_order = ["environment", "name", "application"]
99+
label_order = ["environment", "application", "name"]
100100
cluster_replication_enabled = true
101101
engine = "redis"
102102
engine_version = "5.0.0"
@@ -105,7 +105,7 @@ module "s3_bucket" {
105105
node_type = "cache.t2.micro"
106106
subnet_ids = module.subnets.public_subnet_id
107107
security_group_ids = [module.redis-sg.security_group_ids]
108-
availability_zones = ["us-east-1a", "us-east-1b"]
108+
availability_zones = ["eu-west-1a", "eu-west-1b"]
109109
auto_minor_version_upgrade = true
110110
replicas_per_node_group = 2
111111
num_node_groups = 1
@@ -115,12 +115,11 @@ module "s3_bucket" {
115115
### Memcache
116116
```hcl
117117
module "memcached" {
118-
source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.0"
118+
source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.2"
119119
name = "memcached"
120-
application = "cd"
120+
application = "clouddrove"
121121
environment = "test"
122-
label_order = ["environment", "name", "application"]
123-
122+
label_order = ["environment", "application", "name"]
124123
cluster_enabled = true
125124
engine = "memcached"
126125
engine_version = "1.5.10"

README.yaml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -35,66 +35,66 @@ usage : |-
3535
Here are some examples of how you can use this module in your inventory structure:
3636
### Redis
3737
```hcl
38-
module "redis" {
39-
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.0"
40-
name = "redis"
41-
application = "cd"
42-
environment = "test"
43-
label_order = ["environment", "name", "application"]
44-
engine = "redis"
45-
engine_version = "5.0.0"
46-
family = "redis5.0"
47-
port = 6379
48-
node_type = "cache.t2.micro"
49-
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
50-
security_group_ids = ["sg-xxxxxxxxx"]
51-
availability_zones = ["eu-west-1a","eu-west-1b" ]
52-
auto_minor_version_upgrade = true
53-
number_cache_clusters = 2
54-
}
38+
module "redis" {
39+
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.2"
40+
name = "redis"
41+
application = "clouddrove"
42+
environment = "test"
43+
label_order = ["environment", "application", "name"]
44+
engine = "redis"
45+
engine_version = "5.0.0"
46+
family = "redis5.0"
47+
port = 6379
48+
node_type = "cache.t2.micro"
49+
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
50+
security_group_ids = ["sg-xxxxxxxxx"]
51+
availability_zones = ["eu-west-1a","eu-west-1b" ]
52+
auto_minor_version_upgrade = true
53+
number_cache_clusters = 2
54+
}
55+
5556
```
5657
### Redis Cluster
5758
```hcl
58-
module "s3_bucket" {
59-
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.0"
60-
name = "cluster"
61-
application = "cd"
62-
environment = "test"
63-
label_order = ["environment", "name", "application"]
64-
cluster_replication_enabled = true
65-
engine = "redis"
66-
engine_version = "5.0.0"
67-
family = "redis5.0"
68-
port = 6379
69-
node_type = "cache.t2.micro"
70-
subnet_ids = module.subnets.public_subnet_id
71-
security_group_ids = [module.redis-sg.security_group_ids]
72-
availability_zones = ["us-east-1a", "us-east-1b"]
73-
auto_minor_version_upgrade = true
74-
replicas_per_node_group = 2
75-
num_node_groups = 1
76-
automatic_failover_enabled = true
77-
}
59+
module "redis-cluster" {
60+
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.2"
61+
name = "cluster"
62+
application = "clouddrove"
63+
environment = "test"
64+
label_order = ["environment", "application", "name"]
65+
cluster_replication_enabled = true
66+
engine = "redis"
67+
engine_version = "5.0.0"
68+
family = "redis5.0"
69+
port = 6379
70+
node_type = "cache.t2.micro"
71+
subnet_ids = module.subnets.public_subnet_id
72+
security_group_ids = [module.redis-sg.security_group_ids]
73+
availability_zones = ["eu-west-1a","eu-west-1b" ]
74+
auto_minor_version_upgrade = true
75+
replicas_per_node_group = 2
76+
num_node_groups = 1
77+
automatic_failover_enabled = true
78+
}
7879
```
7980
### Memcache
8081
```hcl
81-
module "memcached" {
82-
source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.0"
83-
name = "memcached"
84-
application = "cd"
85-
environment = "test"
86-
label_order = ["environment", "name", "application"]
87-
88-
cluster_enabled = true
89-
engine = "memcached"
90-
engine_version = "1.5.10"
91-
family = "memcached1.5"
92-
az_mode = "cross-az"
93-
port = 11211
94-
node_type = "cache.t2.micro"
95-
num_cache_nodes = 2
96-
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
97-
security_group_ids = ["sg-xxxxxxxxx"]
98-
availability_zones = ["eu-west-1a","eu-west-1b" ]
99-
}
82+
module "memcached" {
83+
source = "https://github.com/clouddrove/terraform-aws-s3?ref=tags/0.12.2"
84+
name = "memcached"
85+
application = "clouddrove"
86+
environment = "test"
87+
label_order = ["environment", "application", "name"]
88+
cluster_enabled = true
89+
engine = "memcached"
90+
engine_version = "1.5.10"
91+
family = "memcached1.5"
92+
az_mode = "cross-az"
93+
port = 11211
94+
node_type = "cache.t2.micro"
95+
num_cache_nodes = 2
96+
subnet_ids = ["subnet-xxxxxxx","subnet-xxxxxxx","subnet-xxxxxxx"]
97+
security_group_ids = ["sg-xxxxxxxxx"]
98+
availability_zones = ["eu-west-1a","eu-west-1b" ]
99+
}
100100
```

_example/memcached/example.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.1"
6+
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.4"
77

88
name = "vpc"
99
application = "clouddrove"
1010
environment = "test"
11-
label_order = ["environment", "name", "application"]
11+
label_order = ["environment", "application", "name"]
1212

13-
cidr_block = "10.0.0.0/16"
13+
cidr_block = "172.16.0.0/16"
1414
}
1515

1616
module "subnets" {
17-
source = "git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.1"
17+
source = "git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.4"
1818

1919
name = "subnets"
2020
application = "clouddrove"
2121
environment = "test"
22-
label_order = ["application", "environment", "name"]
22+
label_order = ["environment", "application", "name"]
2323

2424
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
2525
vpc_id = module.vpc.vpc_id
@@ -29,25 +29,25 @@ module "subnets" {
2929
}
3030

3131
module "memcached-sg" {
32-
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.1"
32+
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.3"
3333

3434
name = "ssh"
3535
application = "clouddrove"
3636
environment = "test"
37-
label_order = ["environment", "name", "application"]
37+
label_order = ["environment", "application", "name"]
3838

3939
vpc_id = module.vpc.vpc_id
4040
allowed_ip = [module.vpc.vpc_cidr_block]
4141
allowed_ports = [11211]
4242
}
4343

4444
module "memcached" {
45-
source = "git::https://github.com/clouddrove/terraform-aws-elasticache?ref=tags/0.12.0"
45+
source = "./../../"
4646

4747
name = "memcached"
48-
application = "cd"
48+
application = "clouddrove"
4949
environment = "test"
50-
label_order = ["environment", "name", "application"]
50+
label_order = ["environment", "application", "name"]
5151

5252
cluster_enabled = true
5353
engine = "memcached"

0 commit comments

Comments
 (0)