-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Darrell Bolger
committed
Apr 11, 2024
1 parent
e567c6d
commit 5739e2b
Showing
9 changed files
with
132 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
output "id" { | ||
value = aws_ecs_service.main.id | ||
} | ||
|
||
output "name" { | ||
value = aws_ecs_service.main.name | ||
} |
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 @@ | ||
# Changelog |
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,24 @@ | ||
# Service Discovery service | ||
|
||
This module creates a [Service Discovery Service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_service). | ||
|
||
## Usage | ||
|
||
```hcl | ||
module "service_discovery_service" { | ||
source = "https://github.com/gofrontier-com/aws-terraform-modules/releases/download/service_discovery_service/[VERSION]/module.tar.gz//src" | ||
name = "nginx" | ||
namespace_id = aws_service_discovery_private_dns_namespace.main.id | ||
tags = { | ||
WorkloadType = "MortgagesLZ/ai-services" | ||
} | ||
} | ||
``` | ||
|
||
## Known issues | ||
|
||
## Contributing | ||
|
||
See <https://github.com/gofrontier-com/aws-terraform-modules/blob/main/README.rst#contributing>. |
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 @@ | ||
1.0 |
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,30 @@ | ||
resource "aws_service_discovery_service" "main" { | ||
name = var.name | ||
dns_config { | ||
namespace_id = var.namespace_id | ||
routing_policy = var.routing_policy | ||
|
||
dns_records { | ||
ttl = var.ttl | ||
type = var.type | ||
} | ||
} | ||
|
||
dynamic "health_check_custom_config" { | ||
for_each = try([var.health_check_custom_config], []) | ||
content { | ||
failure_threshold = try(health_check_custom_config.value.failure_threshold, null) | ||
} | ||
} | ||
|
||
dynamic "health_check_config" { | ||
for_each = try([var.health_check_config], []) | ||
content { | ||
failure_threshold = try(health_check_config.value.failure_threshold, null) | ||
resource_path = try(health_check_config.value.resource_path, null) | ||
type = try(health_check_config.value.type, null) | ||
} | ||
} | ||
|
||
tags = var.tags | ||
} |
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,7 @@ | ||
output "arn" { | ||
value = aws_service_discovery_service.main.arn | ||
} | ||
|
||
output "id" { | ||
value = aws_service_discovery_service.main.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,41 @@ | ||
variable "health_check_config" { | ||
type = object({ | ||
failure_threshold = optional(number) | ||
resource_path = optional(string) | ||
type = optional(string) | ||
}) | ||
default = null | ||
} | ||
|
||
variable "health_check_custom_config" { | ||
type = map(string) | ||
default = null | ||
} | ||
|
||
variable "name" { | ||
type = string | ||
} | ||
|
||
variable "namespace_id" { | ||
type = string | ||
} | ||
|
||
variable "routing_policy" { | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
variable "ttl" { | ||
type = number | ||
default = 10 | ||
} | ||
|
||
variable "type" { | ||
type = string | ||
default = "A" | ||
} |
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,14 @@ | ||
provider "aws" { | ||
region = "eu-west-2" | ||
} | ||
|
||
module "service_discovery_service" { | ||
source = "../src" | ||
|
||
name = "foo" | ||
namespace_id = "bar" | ||
|
||
tags = { | ||
Foo = "Bar" | ||
} | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = "~> 1.5" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.40" | ||
} | ||
} | ||
} |