Skip to content

Commit

Permalink
Fix new outputs and test
Browse files Browse the repository at this point in the history
  • Loading branch information
snemetz committed Feb 18, 2019
1 parent 34ecc68 commit b1c0326
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 23 deletions.
15 changes: 9 additions & 6 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,24 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| account\_name | - | string | `appzen-test` | no |
| environment | - | string | `mgmt` | no |
| instance\_type | AWS Instance type, if you change, make sure it is compatible with AMI, not all AMIs allow all instance types | string | `m5.large` | no |
| key\_name | SSH key name to use | string | `devops-2018-12-19` | no |
| region | - | string | `us-east-1` | no |
| account\_name | | string | `"appzen-test"` | no |
| environment | | string | `"mgmt"` | no |
| instance\_type | AWS Instance type, if you change, make sure it is compatible with AMI, not all AMIs allow all instance types | string | `"m5.large"` | no |
| key\_name | SSH key name to use | string | `"devops-2018-12-19"` | no |
| region | | string | `"us-east-1"` | no |

## Outputs

| Name | Description |
|------|-------------|
| container\_json | - |
| cluster\_arn | ECS cluster ARN |
| container\_json | |
| lb\_dns\_name | FQDN of ALB provisioned for service (if present) |
| lb\_zone\_id | Route 53 zone ID of ALB provisioned for service (if present) |
| service\_arn | ECS service ARN |
| service\_iam\_role\_arn | ARN of the IAM Role for the ECS Service |
| service\_iam\_role\_name | Name of the IAM Role for the ECS Task |
| service\_name | ECS service name |
| task\_iam\_role\_arn | ARN of the IAM Role for the ECS Task |
| task\_iam\_role\_name | Name of the IAM Role for the ECS Task |

Expand Down
15 changes: 15 additions & 0 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ output "service_iam_role_name" {
value = "${module.basic.service_iam_role_name}"
}

output "cluster_arn" {
description = "ECS cluster ARN"
value = "${module.basic.cluster_arn}"
}

output "service_arn" {
description = "ECS service ARN"
value = "${module.basic.service_arn}"
}

output "service_name" {
description = "ECS service name"
value = "${module.basic.service_name}"
}

output "container_json" {
description = ""
value = "${module.basic.container_json}"
Expand Down
6 changes: 1 addition & 5 deletions examples/basic/providers.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "aws" {
profile = "appzen-admin"
profile = "appzen-test"
region = "${var.region}"

# Make it faster by skipping something
Expand All @@ -8,8 +8,4 @@ provider "aws" {
skip_region_validation = true
skip_credentials_validation = true
skip_requesting_account_id = true

assume_role {
role_arn = "arn:aws:iam::242413444216:role/OrganizationAccountAccessRole"
}
}
13 changes: 8 additions & 5 deletions examples/disabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| environment | - | string | `MGMT` | no |
| instance\_type | AWS Instance type, if you change, make sure it is compatible with AMI, not all AMIs allow all instance types | string | `m5.large` | no |
| key\_name | SSH key name to use | string | `devops20170606` | no |
| region | - | string | `us-west-2` | no |
| environment | | string | `"MGMT"` | no |
| instance\_type | AWS Instance type, if you change, make sure it is compatible with AMI, not all AMIs allow all instance types | string | `"m5.large"` | no |
| key\_name | SSH key name to use | string | `"devops20170606"` | no |
| region | | string | `"us-west-2"` | no |

## Outputs

| Name | Description |
|------|-------------|
| container\_json | - |
| cluster\_arn | ECS cluster ARN |
| container\_json | |
| lb\_dns\_name | FQDN of ALB provisioned for service (if present) |
| lb\_zone\_id | Route 53 zone ID of ALB provisioned for service (if present) |
| service\_arn | ECS service ARN |
| service\_iam\_role\_arn | ARN of the IAM Role for the ECS Service |
| service\_iam\_role\_name | Name of the IAM Role for the ECS Task |
| service\_name | ECS service name |
| task\_iam\_role\_arn | ARN of the IAM Role for the ECS Task |
| task\_iam\_role\_name | Name of the IAM Role for the ECS Task |

Expand Down
15 changes: 15 additions & 0 deletions examples/disabled/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ output "service_iam_role_name" {
value = "${module.disabled.service_iam_role_name}"
}

output "cluster_arn" {
description = "ECS cluster ARN"
value = "${module.disabled.cluster_arn}"
}

output "service_arn" {
description = "ECS service ARN"
value = "${module.disabled.service_arn}"
}

output "service_name" {
description = "ECS service name"
value = "${module.disabled.service_name}"
}

output "container_json" {
description = ""
value = "${module.disabled.container_json}"
Expand Down
26 changes: 26 additions & 0 deletions examples/no_lb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,29 @@ terraform apply
```

Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| account\_name | | string | `"appzen-test"` | no |
| environment | | string | `"mgmt"` | no |
| instance\_type | AWS Instance type, if you change, make sure it is compatible with AMI, not all AMIs allow all instance types | string | `"m5.large"` | no |
| key\_name | SSH key name to use | string | `"devops-2018-12-19"` | no |
| region | | string | `"us-east-1"` | no |

## Outputs

| Name | Description |
|------|-------------|
| cluster\_arn | ECS cluster ARN |
| container\_json | |
| service\_arn | ECS service ARN |
| service\_iam\_role\_arn | ARN of the IAM Role for the ECS Service |
| service\_iam\_role\_name | Name of the IAM Role for the ECS Task |
| service\_name | ECS service name |
| task\_iam\_role\_arn | ARN of the IAM Role for the ECS Task |
| task\_iam\_role\_name | Name of the IAM Role for the ECS Task |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8 changes: 8 additions & 0 deletions examples/no_lb/data.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
data "aws_vpc" "vpc" {
tags {
Env = "${var.environment}"
}
}
/**/
data "aws_vpc" "vpc" {
filter {
name = "tag:Name"
values = ["${var.account_name}-${var.environment}"]
}
}

data "aws_subnet_ids" "private_subnet_ids" {
vpc_id = "${data.aws_vpc.vpc.id}"
Expand Down
15 changes: 15 additions & 0 deletions examples/no_lb/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ output "service_iam_role_name" {
value = "${module.no_lb.service_iam_role_name}"
}

output "cluster_arn" {
description = "ECS cluster ARN"
value = "${module.no_lb.cluster_arn}"
}

output "service_arn" {
description = "ECS service ARN"
value = "${module.no_lb.service_arn}"
}

output "service_name" {
description = "ECS service name"
value = "${module.no_lb.service_name}"
}

output "container_json" {
description = ""
value = "${module.no_lb.container_json}"
Expand Down
3 changes: 2 additions & 1 deletion examples/no_lb/providers.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
provider "aws" {
region = "${var.region}"
profile = "appzen-test"
region = "${var.region}"

# Make it faster by skipping something
skip_get_ec2_platforms = true
Expand Down
10 changes: 7 additions & 3 deletions examples/no_lb/variables.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
variable "account_name" {
default = "appzen-test"
}

variable "environment" {
default = "one"
default = "mgmt"
}

variable "key_name" {
description = "SSH key name to use"
default = "devops20170606"
default = "devops-2018-12-19"
}

variable "region" {
default = "us-west-2"
default = "us-east-1"
}

variable "instance_type" {
Expand Down
6 changes: 3 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ output "service_iam_role_name" {

output "cluster_arn" {
description = "ECS cluster ARN"
value = "${element(compact(concat(aws_ecs_service.service-no-lb.*.cluster, aws_ecs_service.service.*.cluster, list(""))), 0)}"
value = "${element(concat(aws_ecs_service.service-no-lb.*.cluster, aws_ecs_service.service.*.cluster, list("")), 0)}"
}

output "service_arn" {
description = "ECS service ARN"
value = "${element(compact(concat(aws_ecs_service.service-no-lb.*.id, aws_ecs_service.service.*.id, list(""))), 0)}"
value = "${element(concat(aws_ecs_service.service-no-lb.*.id, aws_ecs_service.service.*.id, list("")), 0)}"
}

output "service_name" {
description = "ECS service name"
value = "${element(compact(concat(aws_ecs_service.service-no-lb.*.name, aws_ecs_service.service.*.name, list(""))), 0)}"
value = "${element(concat(aws_ecs_service.service-no-lb.*.name, aws_ecs_service.service.*.name, list("")), 0)}"
}

output "container_json" {
Expand Down

0 comments on commit b1c0326

Please sign in to comment.