Terraform-provider-aws: Add HealthCheckCustomConfig/FailureThreshold support to aws_service_discovery_service

Created on 5 Apr 2018  ยท  5Comments  ยท  Source: hashicorp/terraform-provider-aws

When configuring an AWS Service Discovery _Service_ for a private DNS namespace, it is currently required to set the HealthCheckCustomConfig FailureThreshold.

This is documented here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html

The example AWS gives is:
aws servicediscovery create-private-dns-namespace --name staging --vpc vpc-abcd1234 --region us-east-1 ...
aws servicediscovery create-service --name myapplication --dns-config NamespaceId="ns-uejictsjen2i4eeg",DnsRecords=[{Type="A",TTL="300"}] --health-check-custom-config FailureThreshold=1 --region us-east-1

Although labeled as a complex type, AWS currently only describes one available field for HealthCheckCustomConfig: FailureThreshold.

Here's an example of what a config might look like:

resource "aws_service_discovery_service" "my_service" {
  name = "my_service_name"

  health_check_custom_config {
    failure_threshold = 1
  }

  dns_config {
    dns_records {
      ttl  = 0
      type = "A"
    }

    namespace_id   = "${...namespace_id}"
    routing_policy = "MULTIVALUE"
  }
}
enhancement servicservicediscovery

Most helpful comment

I can verify this bug.

As of commit 82c8a43c1a0c9baf88db73a2b27d883e5a9b1303, it seems to be impossible to use Service Discovery with _private_ Fargate instances because they keep timing out during provisioning. Additionally, I was also able to confirm the fix from @jeffnappi in PR #4083. After building with his PR and adding the requisite stanza to my aws_service_discovery_service resources, everything is working. Thanks Jeff!

All 5 comments

If you do not set the HealthCheckCustomConfig FailureThreshold your tasks will be killed within about 3 minutes with this error: Timeout waiting for service discovery instance provisioning to complete.

I can verify this bug.

As of commit 82c8a43c1a0c9baf88db73a2b27d883e5a9b1303, it seems to be impossible to use Service Discovery with _private_ Fargate instances because they keep timing out during provisioning. Additionally, I was also able to confirm the fix from @jeffnappi in PR #4083. After building with his PR and adding the requisite stanza to my aws_service_discovery_service resources, everything is working. Thanks Jeff!

The enhancement has been merged into master and will release with v1.15.0 of the AWS provider, likely mid next week. We should probably also test/document the failure scenario to help future travelers.

This has been released in version 1.15.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings