Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Data Source Provider for the "Service Discovery" Resources #14881

Closed
dgeorges opened this issue Aug 27, 2020 · 8 comments · Fixed by #25162
Closed

Create a Data Source Provider for the "Service Discovery" Resources #14881

dgeorges opened this issue Aug 27, 2020 · 8 comments · Fixed by #25162
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. new-data-source Introduces a new data source. service/ecs Issues and PRs that pertain to the ecs service. service/servicediscovery Issues and PRs that pertain to the servicediscovery service.
Milestone

Comments

@dgeorges
Copy link

dgeorges commented Aug 27, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Create a Data Source Provider for the Service Discovery Resources:

  • aws_service_discovery_http_namespace
  • aws_service_discovery_private_dns_namespace
  • aws_service_discovery_public_dns_namespace
  • aws_service_discovery_service

New or Affected Resource(s)

The following Data Sources would be new. (The resources already exist)

  • aws_service_discovery_http_namespace
  • aws_service_discovery_private_dns_namespace
  • aws_service_discovery_public_dns_namespace
  • aws_service_discovery_service

Potential Terraform Configuration

Below is a potential use case for how the data sources could be used in a Terraform Configuration

data "aws_service_discovery_private_dns_namespace" "example" {
  name        = "hoge.example.local"
  vpc         = aws_vpc.example.id
}

data "aws_service_discovery_service" "example" {
  name           = "service.name.example"
  vpc              = aws_vpc.example.id
  namespace = data.aws_service_discovery_private_dns_namespace.example.id
 }

...

resource "aws_ecs_service" "mongo" {
  ...
  service_registries = {
     registry_arn = data.aws_service_discovery_service.example.arn
     ....
  }
  ...
}

References

None

@dgeorges dgeorges added the enhancement Requests to existing resources that expand the functionality or scope. label Aug 27, 2020
@ghost ghost added service/ecs Issues and PRs that pertain to the ecs service. service/servicediscovery Issues and PRs that pertain to the servicediscovery service. labels Aug 27, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 27, 2020
@ewbankkit
Copy link
Contributor

@breathingdust breathingdust added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 16, 2021
@jessicastenning
Copy link

Any update on when the data source for aws_service_discovery_service might become available?

@AdamTylerLynch AdamTylerLynch added the good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. label Apr 26, 2022
@brittandeyoung
Copy link
Collaborator

I just opened a pull request that I believe takes care of the remaining requested data sources. Please let me know if there is something in this issue that is not covered by the two additional data sources in the Pull request:

aws_service_discovery_service
aws_service_discovery_http_namespace

@hhh-zest
Copy link

could we merge this pr it would be very helpful

@github-actions github-actions bot added this to the v4.21.0 milestone Jun 27, 2022
@github-actions
Copy link

github-actions bot commented Jul 1, 2022

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@matt-land
Copy link

matt-land commented Jul 6, 2022

Just tried out the new providers in v4.21.0, and @brittandeyoung's PR closes the gap on missing functionality. However, I think the scope of this ticket left off some required functionality for instances.

I think this ticket should have had a data provider "aws_service_discovery_instance" that takes in the cloud map service id and returns the list of instances backing the service, and the instance's individual attributes.

"aws_service_discovery_service" returns the service's attributes and tags as expected. But I have no way to get to the values I need on the instances.

I am using an http only service, so health checks, and dns_config do not apply.

My "service instances" have arbitrary names and each has custom attributes (key/value pairs).

For reference, here is the API call in python for get_instance
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/servicediscovery.html#ServiceDiscovery.Client.get_instance

data aws_service_discovery_instance foo {
    service_id = <service_id>
    instance_ids = [<optional list of instance ids to filter by>]
}

  • return the instance or list of instances
  • return their attributes
  • return their health

@brittandeyoung
Copy link
Collaborator

brittandeyoung commented Jul 6, 2022

@matt-land If there is new functionality needed outside of scope of this issue, please open up a new issue for this functionality as mentioned by the github-action bot. This way it can be tracked and worked on.

@github-actions
Copy link

github-actions bot commented Aug 6, 2022

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. new-data-source Introduces a new data source. service/ecs Issues and PRs that pertain to the ecs service. service/servicediscovery Issues and PRs that pertain to the servicediscovery service.
Projects
None yet
8 participants