Skip to content

Commit

Permalink
Merge pull request integrations#100 from sudomateo/add-importer-ips
Browse files Browse the repository at this point in the history
data-source/github_ip_ranges: Add importer IPs
  • Loading branch information
radeksimko authored Aug 3, 2018
2 parents ef779bb + 1df29fb commit 331d100
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions github/data_source_github_ip_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ func dataSourceGithubIpRanges() *schema.Resource {
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
// TODO: importer IPs coming once this is merged
// https://github.com/google/go-github/pull/881
"importer": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
}
Expand All @@ -38,7 +41,7 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) erro
return err
}

if len(api.Hooks)+len(api.Git)+len(api.Pages) > 0 {
if len(api.Hooks)+len(api.Git)+len(api.Pages)+len(api.Importer) > 0 {
d.SetId("github-ip-ranges")
}
if len(api.Hooks) > 0 {
Expand All @@ -50,6 +53,9 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) erro
if len(api.Pages) > 0 {
d.Set("pages", api.Pages)
}
if len(api.Importer) > 0 {
d.Set("importer", api.Importer)
}

return nil
}
1 change: 1 addition & 0 deletions github/data_source_github_ip_ranges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestAccGithubIpRangesDataSource_existing(t *testing.T) {
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "hooks.#"),
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git.#"),
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages.#"),
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer.#"),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/ip_ranges.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ data "github_ip_ranges" "test" {}
* `hooks` - An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from.
* `git` - An Array of IP addresses in CIDR format specifying the Git servers.
* `pages` - An Array of IP addresses in CIDR format specifying the A records for GitHub Pages.
* `importer` - An Array of IP addresses in CIDR format specifying the A records for GitHub Importer.

0 comments on commit 331d100

Please sign in to comment.