Skip to content

Commit

Permalink
Enhancement: Add Github actions and dependabot in IP Ranges DS (#784)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Erouan50 authored and Jeremy Udit committed Jun 16, 2021
1 parent 0078be2 commit a1e33d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions github/data_source_github_ip_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
},
},
}
}
Expand Down Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions github/data_source_github_ip_ranges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a1e33d4

Please sign in to comment.