diff --git a/examples/basic/README.md b/examples/basic/README.md index 5cadf3c..21df57b 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -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 | diff --git a/examples/basic/outputs.tf b/examples/basic/outputs.tf index 1934312..2c74c37 100644 --- a/examples/basic/outputs.tf +++ b/examples/basic/outputs.tf @@ -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}" diff --git a/examples/basic/providers.tf b/examples/basic/providers.tf index a1127af..665724a 100644 --- a/examples/basic/providers.tf +++ b/examples/basic/providers.tf @@ -1,5 +1,5 @@ provider "aws" { - profile = "appzen-admin" + profile = "appzen-test" region = "${var.region}" # Make it faster by skipping something @@ -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" - } } diff --git a/examples/disabled/README.md b/examples/disabled/README.md index f009d86..f952538 100644 --- a/examples/disabled/README.md +++ b/examples/disabled/README.md @@ -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 | diff --git a/examples/disabled/outputs.tf b/examples/disabled/outputs.tf index 96a7b4a..468be2b 100644 --- a/examples/disabled/outputs.tf +++ b/examples/disabled/outputs.tf @@ -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}" diff --git a/examples/no_lb/README.md b/examples/no_lb/README.md index f70972b..4030e4b 100644 --- a/examples/no_lb/README.md +++ b/examples/no_lb/README.md @@ -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. + + +## 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 | + + diff --git a/examples/no_lb/data.tf b/examples/no_lb/data.tf index c724142..11fe443 100644 --- a/examples/no_lb/data.tf +++ b/examples/no_lb/data.tf @@ -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}" diff --git a/examples/no_lb/outputs.tf b/examples/no_lb/outputs.tf index e9d2a2a..fccbc52 100644 --- a/examples/no_lb/outputs.tf +++ b/examples/no_lb/outputs.tf @@ -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}" diff --git a/examples/no_lb/providers.tf b/examples/no_lb/providers.tf index 31dd57a..665724a 100644 --- a/examples/no_lb/providers.tf +++ b/examples/no_lb/providers.tf @@ -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 diff --git a/examples/no_lb/variables.tf b/examples/no_lb/variables.tf index 400234b..6afbb04 100644 --- a/examples/no_lb/variables.tf +++ b/examples/no_lb/variables.tf @@ -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" { diff --git a/outputs.tf b/outputs.tf index f7346d6..67a4cf1 100644 --- a/outputs.tf +++ b/outputs.tf @@ -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" {