1

I know this is possible through the AWS CLI and Console as I have done it like this but I would now need to do it in Terraform. I would like to execute the equivalent of the CLI command as aws servicediscovery register-instance.

Pointing to any documentation or examples that can be shared would be most beneficial and appreciated.

Marcin
  • 215,873
  • 14
  • 235
  • 294
Jerome Erasmus
  • 115
  • 2
  • 11

2 Answers2

1

This is now possible using the aws_service_discovery_instance resource as of version v3.57.0 of the AWS provider.

resource "aws_service_discovery_instance" "example" {
  instance_id = "mydb"
  service_id  = aws_service_discovery_service.example.id

  attributes = {
    AWS_INSTANCE_CNAME = aws_db_instance.example.address
  }
}
b3n
  • 1,314
  • 1
  • 13
  • 19
0

Adding instances to the discovery service is not yet supported:

But pull requests has already been preprared for that, so hopefully soon:

Marcin
  • 215,873
  • 14
  • 235
  • 294