From fc29bdb8119bc544345bc343062af0289d658154 Mon Sep 17 00:00:00 2001 From: Antoine Rouaze Date: Fri, 21 May 2021 21:23:25 -0400 Subject: [PATCH] Enhancement: Add Github actions and dependabot in IP Ranges DS (#784) It's useful to have the IP range of Github actions to restrict traffics of exposed resources. For example, testing the connectivity of a test database from a Github action without opening the instance to 0.0.0.0/0. --- github/data_source_github_ip_ranges.go | 16 ++++++++++++++++ github/data_source_github_ip_ranges_test.go | 2 ++ 2 files changed, 18 insertions(+) diff --git a/github/data_source_github_ip_ranges.go b/github/data_source_github_ip_ranges.go index e1408fbd82..307dd2298c 100644 --- a/github/data_source_github_ip_ranges.go +++ b/github/data_source_github_ip_ranges.go @@ -29,6 +29,16 @@ func dataSourceGithubIpRanges() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + "actions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "dependabot": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, }, } } @@ -56,6 +66,12 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) erro if len(api.Importer) > 0 { d.Set("importer", api.Importer) } + if len(api.Actions) > 0 { + d.Set("actions", api.Actions) + } + if len(api.Dependabot) > 0 { + d.Set("dependabot", api.Dependabot) + } return nil } diff --git a/github/data_source_github_ip_ranges_test.go b/github/data_source_github_ip_ranges_test.go index 71b626799b..224b85d0e5 100644 --- a/github/data_source_github_ip_ranges_test.go +++ b/github/data_source_github_ip_ranges_test.go @@ -17,6 +17,8 @@ func TestAccGithubIpRangesDataSource(t *testing.T) { resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git.#"), resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages.#"), resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer.#"), + resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions.#"), + resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "dependabot.#"), ) testCase := func(t *testing.T, mode string) {