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

datasource/github_ip_ranges: implement ip datasource via the GH Meta api #82

Merged
merged 3 commits into from
Mar 29, 2018
Merged

datasource/github_ip_ranges: implement ip datasource via the GH Meta api #82

merged 3 commits into from
Mar 29, 2018

Conversation

appilon
Copy link
Contributor

@appilon appilon commented Mar 26, 2018

Fix #78

Implemented data source to pull github's ip addresses. Rigged up the StopContext to pass through to the api call (should probably be done elsewhere in the provider as well).

One of the ip sets (importer) is not yet implemented in the go-github library. I'll open a PR for that so we can polish off this data source in a follow up PR.

go-github PR google/go-github#881

@paultyng
Copy link
Contributor

This would address #78 (just linking it in here).


func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client
ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be the StopContext?

@appilon appilon changed the title [WIP] implement ip datasource via the GH Meta api datasource/github_ip_ranges: implement ip datasource via the GH Meta api Mar 28, 2018
}

if len(api.Hooks)+len(api.Git)+len(api.Pages) > 0 {
d.SetId("github-ip-ranges")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what to set here? I suppose it doesn't matter in this case? Anyone let me know!

@paultyng
Copy link
Contributor

These are all always IPv4 I think? Just want to confirm that, and possibly document it.

Copy link
Contributor

@paultyng paultyng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, may want to have someone else confirm the const ID is fine, I don't know about that, I've seen like Now as well.

@appilon
Copy link
Contributor Author

appilon commented Mar 28, 2018

@paultyng the /meta endpoint gives examples that are IPv4 but there doesn't appear to be any docs that guarantee it. Let me know if you want me to change any documentation. Also I opened a PR to go-github to get the last set (importer) we could wait on that PR and then update this one with full coverage!

@vancluever vancluever added the Type: Feature New feature or request label Mar 28, 2018
@paultyng
Copy link
Contributor

I'd say just link your PR in a TODO comment or something to indicate why it doesn't have that data in the data source, then this is good to go.

@appilon appilon merged commit 8613fc6 into integrations:master Mar 29, 2018
@paultyng
Copy link
Contributor

This was released in v1.1.0

kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
datasource/github_ip_ranges: implement ip datasource via the GH Meta api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants