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

Utility Providers Upgrade #136

Merged
merged 15 commits into from
May 25, 2022
Merged

Utility Providers Upgrade #136

merged 15 commits into from
May 25, 2022

Conversation

bendbennett
Copy link
Contributor

@bendbennett bendbennett marked this pull request as ready for review May 19, 2022 15:32
@bendbennett bendbennett requested a review from a team as a code owner May 19, 2022 15:32
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Very exciting!

},
Config: fmt.Sprintf(testDataSourceConfigBasic, testHttpMock.server.URL, 200),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceBasic("data.http.http_test"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this could be written as the below using the acceptance testing helper functions, rather than introducing indirection with a separate function:

resource.TestCheckResourceAttr("data.http.http_test", "body", "1.0.0"),
resource.TestCheckResourceAttr("data.http.http_test", "response_headers.X-Single", "foobar"),
resource.TestCheckResourceAttr("data.http.http_test", "response_headers.X-Double", "1, 2"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Fixed

},
Config: fmt.Sprintf(testDataSourceConfigWithHeaders, testHttpMock.server.URL, 200),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceHeaders("data.http.http_test"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this could be written as the below using the acceptance testing helper functions, rather than introducing indirection with a separate function:

resource.TestCheckResourceAttr("data.http.http_test", "body", "1.0.0"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

},
Config: fmt.Sprintf(testDataSourceConfigUTF8, testHttpMock.server.URL, 200),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceUTF8("data.http.http_test"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this could be written as the below using the acceptance testing helper functions, rather than introducing indirection with a separate function:

resource.TestCheckResourceAttr("data.http.http_test", "body", "1.0.0"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 152 to 159

output "body" {
value = data.http.http_test.body
}

output "response_headers" {
value = data.http.http_test.response_headers
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing outputs is generally extraneous as compared to just directly checking the data source in question. 👍

Suggested change
output "body" {
value = data.http.http_test.body
}
output "response_headers" {
value = data.http.http_test.response_headers
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Comment on lines 170 to 173

output "body" {
value = data.http.http_test.body
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing outputs is generally extraneous as compared to just directly checking the data source in question. 👍

Suggested change
output "body" {
value = data.http.http_test.body
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Comment on lines 190 to 193

output "body" {
value = "${data.http.http_test.body}"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing outputs is generally extraneous as compared to just directly checking the data source in question. 👍

Suggested change
output "body" {
value = "${data.http.http_test.body}"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Comment on lines -51 to -53
* `response_headers` - A map of strings representing the response HTTP headers.
Duplicate headers are contatenated with `, ` according to
[RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we still be capturing this additional RFC detail in the attribute description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error on my part. Have reinstated.

DESIGN.md Outdated
## Goals

* [_Stability over features_](.github/CONTRIBUTING.md)
* Provide managed data source to issue HTTP GET request.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there IETF and/pr W3 RFCs to link to for this design choice? Which HTTP versions are supported? Are non-standard HTTP implementations supported (e.g. SPDY, QUIC)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Very good points.

Given the influx of requests, and the fact that once you start merging things here new requests for features are going to come, it's important to pin point which specific HTTP we support here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have updated DESIGN.md.

DESIGN.md Outdated

* [_Stability over features_](.github/CONTRIBUTING.md)
* Provide managed data source to issue HTTP GET request.
* Support usage of requests to URLs directed to either `http` or `https`.
Copy link
Contributor

Choose a reason for hiding this comment

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

What implementation details of HTTPS are supported? TLS 1.0 or 1.1 (😬 )? 1.3? Are there relevant IETF/W3 RFCs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Likely this can be also done by looking at the godoc for the HTTP client we use. And probably they link to these information there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have updated DESIGN.md.

.golangci.yml Show resolved Hide resolved
Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

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

Aside from a few comments on the DESING.md, I essentially echo what @bflad spotted, especially for testing (and we already touched upon this in our daily chat).

But overall this is already looking great: very glad we are able to bring more and more consistency across those providers.

DESIGN.md Outdated
## Goals

* [_Stability over features_](.github/CONTRIBUTING.md)
* Provide managed data source to issue HTTP GET request.
Copy link
Contributor

Choose a reason for hiding this comment

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

Very good points.

Given the influx of requests, and the fact that once you start merging things here new requests for features are going to come, it's important to pin point which specific HTTP we support here.

DESIGN.md Outdated

* [_Stability over features_](.github/CONTRIBUTING.md)
* Provide managed data source to issue HTTP GET request.
* Support usage of requests to URLs directed to either `http` or `https`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Likely this can be also done by looking at the godoc for the HTTP client we use. And probably they link to these information there.

Comment on lines +22 to +23
* Only idempotent GET requests are supported.
* Only 200 status codes are considered successful.
Copy link
Contributor

Choose a reason for hiding this comment

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

And I assume this will be updated once your RFC is finalised and work begin to expand this bit?

@bendbennett bendbennett requested review from detro and bflad May 24, 2022 06:50
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks good to me 🚀 Just some minor additional considerations for the design documentation.

Comment on lines +14 to +15
HTTP URLs and either [HTTP/1.1](https://datatracker.ietf.org/doc/html/rfc2616) or
[HTTP/2.0](https://datatracker.ietf.org/doc/html/rfc7540) for HTTPS URLs depending on whether the server supports
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe just me but the usage of "URLs" tripped me up slightly here, as I thought it was somehow relating to the actual URL (scheme, host, port, etc.) Maybe clearer to say some thing like HTTP (plaintext) requests and HTTPS (secure) requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point. Have amended.

DESIGN.md Outdated
Comment on lines 19 to 20
* Support usage of requests to URLs directed to either `http` or `https`. The current version of this provider is built
with [Go 1.17](https://go.dev/doc/go1.17) which [supports](https://go.dev/doc/go1.17#minor_library_changes)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is excellent! I wonder if it is worth calling out that Go updates may change this support over time based on the fluid security landscape? For example, I believe Go 1.18 removes TLS/1.0 and TLS/1.1 support. I don't think we need to call out the Go 1.18 thing explicitly here, but I think it is worth ensuring we are free to track Go upgrades according to the design.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added a statement reflecting that TLS support will track the underlying Go version the provider is built with and will likely change over time.

DESIGN.md Outdated
[TLS/1.0](https://www.ietf.org/rfc/rfc2246.txt) ([deprecated](https://datatracker.ietf.org/doc/rfc8996/)),
[TLS/1.1](https://datatracker.ietf.org/doc/html/rfc4346) ([deprecated](https://datatracker.ietf.org/doc/rfc8996/)),
[TLS/1.2](https://datatracker.ietf.org/doc/html/rfc5246) and
[TLS/1.3](https://datatracker.ietf.org/doc/html/rfc8446) (supported since [Go 1.13](https://go.dev/doc/go1.13#tls_1_3)).
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can omit the final parenthesis statement here since as saying Go 1.13 won't mean much for practitioners (as they'd have to determine which provider versions were built and released on that Go version) 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, have removed.

@bendbennett bendbennett merged commit fff9b1c into main May 25, 2022
@bendbennett bendbennett deleted the bendbennett/issues-135 branch May 25, 2022 10:18
@bendbennett bendbennett mentioned this pull request May 25, 2022
13 tasks
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants