Skip to content

Commit f73621b

Browse files
committed
Merge branch 'main' into v6
2 parents 8bed68e + 970dd20 commit f73621b

13 files changed

+129
-32
lines changed

.github/workflows/immediate-response.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: echo "NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
2020

2121
- name: Respond to issue or PR
22-
uses: peter-evans/create-or-update-comment@v3
22+
uses: peter-evans/create-or-update-comment@v4
2323
with:
2424
issue-number: ${{ steps.extract.outputs.NUMBER }}
2525
body: >

github/data_source_github_ip_ranges.go

+25
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ func dataSourceGithubIpRanges() *schema.Resource {
3232
Computed: true,
3333
Elem: &schema.Schema{Type: schema.TypeString},
3434
},
35+
"packages": {
36+
Type: schema.TypeList,
37+
Computed: true,
38+
Elem: &schema.Schema{Type: schema.TypeString},
39+
},
3540
"pages": {
3641
Type: schema.TypeList,
3742
Computed: true,
@@ -72,6 +77,11 @@ func dataSourceGithubIpRanges() *schema.Resource {
7277
Computed: true,
7378
Elem: &schema.Schema{Type: schema.TypeString},
7479
},
80+
"packages_ipv4": {
81+
Type: schema.TypeList,
82+
Computed: true,
83+
Elem: &schema.Schema{Type: schema.TypeString},
84+
},
7585
"pages_ipv4": {
7686
Type: schema.TypeList,
7787
Computed: true,
@@ -112,6 +122,11 @@ func dataSourceGithubIpRanges() *schema.Resource {
112122
Computed: true,
113123
Elem: &schema.Schema{Type: schema.TypeString},
114124
},
125+
"packages_ipv6": {
126+
Type: schema.TypeList,
127+
Computed: true,
128+
Elem: &schema.Schema{Type: schema.TypeString},
129+
},
115130
"pages_ipv6": {
116131
Type: schema.TypeList,
117132
Computed: true,
@@ -154,6 +169,11 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) erro
154169
return err
155170
}
156171

172+
cidrPackagesIpv4, cidrPackagesIpv6, err := splitIpv4Ipv6Cidrs(&api.Packages)
173+
if err != nil {
174+
return err
175+
}
176+
157177
cidrPagesIpv4, cidrPagesIpv6, err := splitIpv4Ipv6Cidrs(&api.Pages)
158178
if err != nil {
159179
return err
@@ -215,6 +235,11 @@ func dataSourceGithubIpRangesRead(d *schema.ResourceData, meta interface{}) erro
215235
return err
216236
}
217237
}
238+
if len(api.Packages) > 0 {
239+
d.Set("packages", api.Packages)
240+
d.Set("packages_ipv4", cidrPackagesIpv4)
241+
d.Set("packages_ipv6", cidrPackagesIpv6)
242+
}
218243
if len(api.Pages) > 0 {
219244
err = d.Set("pages", api.Pages)
220245
if err != nil {

github/data_source_github_ip_ranges_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
1717
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git.#"),
1818
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "api.#"),
1919
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "web.#"),
20+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "packages.#"),
2021
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages.#"),
2122
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer.#"),
2223
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions.#"),
@@ -25,6 +26,7 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
2526
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git_ipv4.#"),
2627
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "api_ipv4.#"),
2728
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "web_ipv4.#"),
29+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "packages_ipv4.#"),
2830
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages_ipv4.#"),
2931
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer_ipv4.#"),
3032
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_ipv4.#"),
@@ -33,6 +35,7 @@ func TestAccGithubIpRangesDataSource(t *testing.T) {
3335
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "git_ipv6.#"),
3436
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "api_ipv6.#"),
3537
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "web_ipv6.#"),
38+
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "packages_ipv6.#"),
3639
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "pages_ipv6.#"),
3740
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "importer_ipv6.#"),
3841
resource.TestCheckResourceAttrSet("data.github_ip_ranges.test", "actions_ipv6.#"),

github/data_source_github_rest_api.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package github
22

33
import (
44
"context"
5+
"encoding/json"
56

67
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
78
)
@@ -25,11 +26,11 @@ func dataSourceGithubRestApi() *schema.Resource {
2526
Computed: true,
2627
},
2728
"headers": {
28-
Type: schema.TypeMap,
29+
Type: schema.TypeString,
2930
Computed: true,
3031
},
3132
"body": {
32-
Type: schema.TypeMap,
33+
Type: schema.TypeString,
3334
Computed: true,
3435
},
3536
},
@@ -51,19 +52,28 @@ func dataSourceGithubRestApiRead(d *schema.ResourceData, meta interface{}) error
5152

5253
resp, _ := client.Do(ctx, req, &body)
5354

55+
h, err := json.Marshal(resp.Header)
56+
if err != nil {
57+
return err
58+
}
59+
60+
b, err := json.Marshal(body)
61+
if err != nil {
62+
return err
63+
}
64+
5465
d.SetId(resp.Header.Get("x-github-request-id"))
5566
if err = d.Set("code", resp.StatusCode); err != nil {
5667
return err
5768
}
5869
if err = d.Set("status", resp.Status); err != nil {
5970
return err
6071
}
61-
if err = d.Set("headers", resp.Header); err != nil {
72+
if err = d.Set("headers", string(h)); err != nil {
6273
return err
6374
}
64-
if err = d.Set("body", body); err != nil {
75+
if err = d.Set("body", string(b)); err != nil {
6576
return err
6677
}
67-
6878
return nil
6979
}

github/data_source_github_rest_api_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ func TestAccGithubRestApiDataSource(t *testing.T) {
3030
resource.TestMatchResourceAttr(
3131
"data.github_rest_api.test", "code", regexp.MustCompile("200"),
3232
),
33+
resource.TestMatchResourceAttr(
34+
"data.github_rest_api.test", "status", regexp.MustCompile("200 OK"),
35+
),
36+
resource.TestCheckResourceAttrSet("data.github_rest_api.test", "body"),
37+
resource.TestCheckResourceAttrSet("data.github_rest_api.test", "headers"),
3338
)
3439

3540
testCase := func(t *testing.T, mode string) {
@@ -76,6 +81,11 @@ func TestAccGithubRestApiDataSource(t *testing.T) {
7681
resource.TestMatchResourceAttr(
7782
"data.github_rest_api.test", "code", regexp.MustCompile("404"),
7883
),
84+
resource.TestMatchResourceAttr(
85+
"data.github_rest_api.test", "status", regexp.MustCompile("404 Not Found"),
86+
),
87+
resource.TestCheckResourceAttrSet("data.github_rest_api.test", "body"),
88+
resource.TestCheckResourceAttrSet("data.github_rest_api.test", "headers"),
7989
)
8090

8191
testCase := func(t *testing.T, mode string) {

go.mod

+13-16
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,26 @@ require (
66
github.com/client9/misspell v0.3.4
77
github.com/golangci/golangci-lint v1.41.1
88
github.com/google/go-github/v57 v57.0.0
9-
github.com/google/uuid v1.5.0
9+
github.com/google/uuid v1.6.0
1010
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
11+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
1112
github.com/shurcooL/githubv4 v0.0.0-20221126192849-0b5c4c7994eb
1213
github.com/stretchr/testify v1.8.4
1314
golang.org/x/crypto v0.18.0
1415
golang.org/x/oauth2 v0.16.0
1516
gopkg.in/square/go-jose.v2 v2.6.0
1617
)
1718

18-
require (
19-
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
20-
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
21-
github.com/cloudflare/circl v1.3.3 // indirect
22-
github.com/hashicorp/hc-install v0.6.2 // indirect
23-
github.com/hashicorp/terraform-plugin-go v0.20.0 // indirect
24-
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
25-
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
26-
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
27-
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
28-
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
29-
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
30-
)
31-
3219
require (
3320
4d63.com/gochecknoglobals v0.1.0 // indirect
3421
github.com/BurntSushi/toml v1.2.1 // indirect
3522
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
3623
github.com/Masterminds/semver v1.5.0 // indirect
3724
github.com/OpenPeeDeeP/depguard v1.1.1 // indirect
25+
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
3826
github.com/agext/levenshtein v1.2.2 // indirect
3927
github.com/alexkohler/prealloc v1.0.0 // indirect
28+
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
4029
github.com/ashanbrown/forbidigo v1.3.0 // indirect
4130
github.com/ashanbrown/makezero v1.1.1 // indirect
4231
github.com/beorn7/perks v1.0.1 // indirect
@@ -45,6 +34,7 @@ require (
4534
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4635
github.com/charithe/durationcheck v0.0.9 // indirect
4736
github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect
37+
github.com/cloudflare/circl v1.3.3 // indirect
4838
github.com/daixiang0/gci v0.2.9 // indirect
4939
github.com/davecgh/go-spew v1.1.1 // indirect
5040
github.com/denis-tingajkin/go-header v0.4.2 // indirect
@@ -91,12 +81,16 @@ require (
9181
github.com/hashicorp/go-plugin v1.6.0 // indirect
9282
github.com/hashicorp/go-uuid v1.0.3 // indirect
9383
github.com/hashicorp/go-version v1.6.0 // indirect
84+
github.com/hashicorp/hc-install v0.6.2 // indirect
9485
github.com/hashicorp/hcl v1.0.0 // indirect
9586
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
9687
github.com/hashicorp/logutils v1.0.0 // indirect
9788
github.com/hashicorp/terraform-exec v0.19.0 // indirect
9889
github.com/hashicorp/terraform-json v0.18.0 // indirect
99-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
90+
github.com/hashicorp/terraform-plugin-go v0.20.0 // indirect
91+
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
92+
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
93+
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
10094
github.com/hashicorp/yamux v0.1.1 // indirect
10195
github.com/inconshreveable/mousetrap v1.0.1 // indirect
10296
github.com/jgautheron/goconst v1.5.1 // indirect
@@ -172,6 +166,9 @@ require (
172166
github.com/ultraware/funlen v0.0.3 // indirect
173167
github.com/ultraware/whitespace v0.0.5 // indirect
174168
github.com/uudashr/gocognit v1.0.6 // indirect
169+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
170+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
171+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
175172
github.com/yeya24/promlinter v0.2.0 // indirect
176173
github.com/zclconf/go-cty v1.14.1 // indirect
177174
golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4Mgqvf
345345
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
346346
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
347347
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
348-
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
349-
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
348+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
349+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
350350
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
351351
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
352352
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=

vendor/github.com/google/uuid/CHANGELOG.md

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/hash.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/google/uuid/version7.go

+34-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ github.com/google/go-github/v57/github
242242
# github.com/google/go-querystring v1.1.0
243243
## explicit; go 1.10
244244
github.com/google/go-querystring/query
245-
# github.com/google/uuid v1.5.0
245+
# github.com/google/uuid v1.6.0
246246
## explicit
247247
github.com/google/uuid
248248
# github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8

website/docs/d/ip_ranges.html.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ data "github_ip_ranges" "test" {}
3535
* `api` - An Array of IP addresses in CIDR format for the GitHub API.
3636
* `api_ipv4` - A subset of the `api` array that contains IP addresses in IPv4 CIDR format.
3737
* `api_ipv6` - A subset of the `api` array that contains IP addresses in IPv6 CIDR format.
38+
* `packages` - An Array of IP addresses in CIDR format specifying the A records for GitHub Packages.
39+
* `packages_ipv4` - A subset of the `packages` array that contains IP addresses in IPv4 CIDR format.
40+
* `packages_ipv6` - A subset of the `packages` array that contains IP addresses in IPv6 CIDR format.
3841
* `pages` - An Array of IP addresses in CIDR format specifying the A records for GitHub Pages.
3942
* `pages_ipv4` - A subset of the `pages` array that contains IP addresses in IPv4 CIDR format.
4043
* `pages_ipv6` - A subset of the `pages` array that contains IP addresses in IPv6 CIDR format.

website/docs/d/rest_api.html.markdown

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ data "github_rest_api" "example" {
2323

2424
## Attributes Reference
2525

26+
* `id` - The GitHub API Request ID
2627
* `code` - A response status code.
2728
* `status` - A response status string.
28-
* `headers` - A map of response headers.
29-
* `body` - A map of response body.
29+
* `headers` - A JSON string containing response headers.
30+
* `body` - A JSON string containing response body.

0 commit comments

Comments
 (0)