Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Darrell Bolger committed Apr 11, 2024
1 parent e567c6d commit 5739e2b
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/ecs-service/src/outputs.tf
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
}
1 change: 1 addition & 0 deletions modules/service_discovery_service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
24 changes: 24 additions & 0 deletions modules/service_discovery_service/README.md
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>.
1 change: 1 addition & 0 deletions modules/service_discovery_service/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
30 changes: 30 additions & 0 deletions modules/service_discovery_service/src/main.tf
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
}
7 changes: 7 additions & 0 deletions modules/service_discovery_service/src/outputs.tf
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
}
41 changes: 41 additions & 0 deletions modules/service_discovery_service/src/variables.tf
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"
}
14 changes: 14 additions & 0 deletions modules/service_discovery_service/test/main.tf
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"
}
}
10 changes: 10 additions & 0 deletions modules/service_discovery_service/test/terraform.tf
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"
}
}
}

0 comments on commit 5739e2b

Please sign in to comment.