Skip to content

Commit dd365ba

Browse files
committed
Replace vpc in example, update README.
1 parent 2351f3a commit dd365ba

File tree

5 files changed

+34
-27
lines changed

5 files changed

+34
-27
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ On mac simple install tfenv using brew.
1515
```
1616
brew install tfenv
1717
```
18-
Next intall a terraform version.
18+
Next install a terraform version.
1919
```
2020
tfenv install <version>
2121
```
@@ -34,24 +34,24 @@ Currently register a new runner is a manual process. See the GitLab Runner [docu
3434
```
3535
docker run -it --rm gitlab/gitlab-runner register
3636
```
37-
Provide the details in the interactive terminal. Once done the token cen found in the GitLab runners section, choose edit to get the token or see the config.toml file.
37+
Provide the details in the interactive terminal. Once done the token can be found in the GitLab runners section, choose edit to get the token or see the config.toml file.
3838

3939

4040
## Usage
4141

4242
### Configuration
43-
Update the variables in `terraform.tfvars` to your needs and add the folling variables, see prevous step for how to obtain the token.
43+
Update the variables in `terraform.tfvars` to your needs and add the following variables, see previous step for how to obtain the token.
4444
```
45-
runner_name = "NAME_OF_YOUR_RUNNER"
46-
gitlab_url = "GIT_LAB_URL"
47-
runner_token = "RUNNER_TOKEN"
45+
runner_name = "NAME_OF_YOUR_RUNNER"
46+
gitlab_url = "GIT_LAB_URL"
47+
runner_token = "RUNNER_TOKEN"
4848
```
4949

5050

5151
### Usage module.
5252
```
5353
module "runner" {
54-
source = "https://github.com/npalm/terraform-aws-gitlab-runner.git"
54+
source = "npalm/gitlab-runner/aws"
5555
5656
aws_region = "${var.aws_region}"
5757
environment = "${var.environment}"
@@ -78,8 +78,8 @@ All variables and defaults:
7878
| docker_machine_instance_type | Instance type used for the instances hosting docker-machine. | string | `m4.large` | no |
7979
| docker_machine_spot_price_bid | Spot price bid. | string | `0.03` | no |
8080
| docker_machine_user | User name for the user to create spot instances to host docker-machine. | string | `docker-machine` | no |
81-
| enable_cloudwatch_logging | Enable or disable the cloudwatch logging. | string | `0` | no |
82-
| environment | A name that indentifies the environment, will used as prefix and for taggin. | string | - | yes |
81+
| enable_cloudwatch_logging | Enable or disable the CloudWatch logging. | string | `1` | no |
82+
| environment | A name that identifies the environment, will used as prefix and for tagging. | string | - | yes |
8383
| gitlab_runner_version | Version for the gitlab runner. | string | `10.2.0` | no |
8484
| instance_type | Instance type used for the gitlab-runner. | string | `t2.micro` | no |
8585
| runners_concurrent | Concurrent value for the runners, will be used in the runner config.toml | string | `10` | no |
@@ -110,11 +110,11 @@ docker run -it --rm gitlab/gitlab-runner register
110110
Once done, lookup the token in GitLab and update the `terraform.tfvars` file.
111111

112112
## Create runner
113-
Run `terraform init` to initialize terraform. Next you can run `terraform plan` to inspect the resources that will be created.
113+
Run `terraform init` to initialise terraform. Next you can run `terraform plan` to inspect the resources that will be created.
114114

115115
To create the runner run:
116116
```
117-
terrafrom apply
117+
terraform apply
118118
```
119119
To destroy runner:
120120
```
File renamed without changes.

example/main.tf

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,35 @@ provider "template" {
88
}
99

1010
module "vpc" {
11-
source = "git::https://github.com/npalm/tf-aws-vpc.git?ref=1.0.0"
11+
source = "terraform-aws-modules/vpc/aws"
12+
version = "1.5.1"
1213

13-
aws_region = "${var.aws_region}"
14-
environment = "${var.environment}"
14+
name = "vpc-${var.environment}"
15+
cidr = "10.0.0.0/16"
1516

16-
create_private_hosted_zone = "true"
17-
create_private_subnets = "true"
17+
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
18+
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
19+
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
1820

19-
availability_zones = {
20-
us-east-1 = ["us-east-1a"]
21-
eu-west-1 = ["eu-west-1a"]
21+
enable_nat_gateway = true
22+
23+
tags = {
24+
Environment = "${var.environment}"
2225
}
2326
}
2427

2528
module "runner" {
2629
source = "../"
2730

28-
aws_region = "${var.aws_region}"
29-
environment = "${var.environment}"
30-
ssh_public_key = "${file("${var.ssh_key_file}")}"
31+
aws_region = "${var.aws_region}"
32+
environment = "${var.environment}"
33+
ssh_public_key = "${file("${var.ssh_key_file}")}"
34+
3135
vpc_id = "${module.vpc.vpc_id}"
3236
subnet_id_gitlab_runner = "${element(module.vpc.private_subnets, 0)}"
3337
subnet_id_runners = "${element(module.vpc.private_subnets, 0)}"
34-
runners_name = "${var.runner_name}"
35-
runners_gitlab_url = "${var.gitlab_url}"
36-
runners_token = "${var.runner_token}"
38+
39+
runners_name = "${var.runner_name}"
40+
runners_gitlab_url = "${var.gitlab_url}"
41+
runners_token = "${var.runner_token}"
3742
}

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ resource "aws_launch_configuration" "gitlab_runner_instance" {
154154
instance_type = "${var.instance_type}"
155155
iam_instance_profile = "${aws_iam_instance_profile.instance.name}"
156156

157+
associate_public_ip_address = false
158+
157159
lifecycle {
158160
create_before_destroy = true
159161
}

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ variable "aws_region" {
44
}
55

66
variable "environment" {
7-
description = "A name that indentifies the environment, will used as prefix and for taggin."
7+
description = "A name that identifies the environment, will used as prefix and for tagging."
88
type = "string"
99
}
1010

@@ -132,6 +132,6 @@ variable "gitlab_runner_version" {
132132
}
133133

134134
variable "enable_cloudwatch_logging" {
135-
description = "Enable or disable the cloudwatch logging."
135+
description = "Enable or disable the CloudWatch logging."
136136
default = 1
137137
}

0 commit comments

Comments
 (0)