terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Upgrade Automation/Runbook API version from `2020-01-13-preview` to `2019-06-01`

Open wuxu92 opened this issue 2 years ago • 10 comments

For updating from 2020-01-13-preview to 2019-06-01 may cause incompatible changes, so I only updated the Runbook resource which is trying to fix the issue https://github.com/hashicorp/terraform-provider-azurerm/issues/1602. the version number of 2019-06-01 looks smaller than the 2020-01-13, but there is no newer stable version for runbook to use.

and because there are some breaking changes in swagger which cause the RunbookClient.GetContent and RunbookDraftClinet.Create cannot work in 2019-06-01 so these two Calls keep using the 2020-01-13-preview of Azure/azure-sdk-for-go. more detail in this issue comment: https://github.com/Azure/azure-sdk-for-go/issues/17591#issuecomment-1233676539 .

wuxu92 avatar Sep 01 '22 08:09 wuxu92

yes, the root source is the swagger broken. en... as for runbook resource, it uses stable/2018-06-30/runbook.json in 2020-01-13-preview Track 1 sdk, so it is a kind of API upgrade in this PR in fact. the track 1 version management is a bit messy I think.

and hashicorp/go-azure-sdk cannot generate for a single resource making us have to cross API versions. or we directly generate the stable/2018-06-30 version in hashicorp/go-azure-sdk then we can fix the runbook issue all in one version. but still, that makes us keep both hashicorp and azure versions of sdk in azurerm.

wuxu92 avatar Sep 07 '22 03:09 wuxu92

@wuxu92 - can we get the service team to fix the swagger? or is this the way they are going to detail their api in the specs going forward? if so it seems like what we should do is fix the pandora generator so it handles this new file type?

katbyte avatar Sep 09 '22 00:09 katbyte

yes, seems the service team will not revert this change because azure-sdk-go-go has released a Track2 SDK(which is compatible with this swagger) to replace the track1 SDK. As I know that @manicminer is working on the pandora generator to use a new base layer to fix this. but i don't know when will it be released.

wuxu92 avatar Sep 09 '22 06:09 wuxu92

@wuxu92 The new base layer is not too far from ready but is still going through testing. Can you detail the issue? If you think this should/could be solved with an improved base client I'd like to make sure that's indeed the case :)

manicminer avatar Sep 12 '22 08:09 manicminer

@manicminer Thanks for your work! The case here is when the response body is a single string, not structured data, Track1 and current pandora will try to json.Unmarshal the HTTP response body to a string pointer which raises a JSON error. it would be beneficial if you could test this case in the new base layer.

Below is an example of track1 code (and the current pandora SDK is almost the same).

func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result String, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result.Value),   // <-- result.Value is a *string
		autorest.ByClosing())

the error message: Error occurred unmarshalling JSON - Error = 'invalid character 'C' looking for beginning of value'

wuxu92 avatar Sep 13 '22 01:09 wuxu92

@wuxu92 - how does track 2 handle it differently?

katbyte avatar Sep 13 '22 16:09 katbyte

@katbyte Track2 replaced autorest with a new base layer, but it has new authentication and other features designed not working for azurerm.

wuxu92 avatar Sep 13 '22 21:09 wuxu92

@wuxu92 - i meant more how does it handle this "file" swagger change?

katbyte avatar Sep 14 '22 03:09 katbyte

Blocked on https://github.com/Azure/azure-rest-api-specs/pull/20588

tombuildsstuff avatar Sep 15 '22 14:09 tombuildsstuff

Since https://github.com/Azure/azure-rest-api-specs/pull/20588 was merged 3 days ago, is there anything blocking this going though?

DuneganS avatar Sep 22 '22 13:09 DuneganS

@wuxu92 - now that the swagger PR has been merged can we update the go-azure-sdk version (in a separate PR please) if needed and not split the service across API versions now?

katbyte avatar Sep 28 '22 05:09 katbyte

@katbyte since the hashicorp/go-azure-sdk's new base layer is not released, and the current generated code for 2019-06-01 still broken the process(as described before). so it's still needed to use both hashi SDK and azure Trask1 SDK.

I think a better way is wanting for @manicminer 's new base layer to be ready, so we can use only hashi's SDK to support this. it is expected to be ready in recent weeks.

wuxu92 avatar Sep 28 '22 06:09 wuxu92

I think a better way is wanting for @manicminer 's new base layer to be ready, so we can use only hashi's SDK to support this. it is expected to be ready in recent weeks.

Does this mean that this change would not resolve the issue? Im just looking for an ETA on when we will be able to create Python based runbooks using Terraform.

DuneganS avatar Oct 04 '22 13:10 DuneganS

@wuxu92 - ok, is this good to merge before then to add the new property? tests seem to be passing and we can consolidate versions at a later date

katbyte avatar Oct 12 '22 16:10 katbyte

@katbyte thanks for your review i have updated the pr and re-run the tests

image

wuxu92 avatar Oct 19 '22 07:10 wuxu92

This functionality has been released in v3.28.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Oct 24 '22 08:10 github-actions[bot]

Can anyone confirm that this was included in version 3.28.0? In the documentation I still do not see the options for Python2/3 and and I still get the error that they are not options.

DuneganS avatar Oct 25 '22 03:10 DuneganS

Can anyone confirm that this was included in version 3.28.0? In the documentation I still do not see the options for Python2/3 and and I still get the error that they are not options.

hi @DuneganS python 2/3 has been added in https://github.com/hashicorp/terraform-provider-azurerm/pull/18921 which release in 3.28.0 too. could you please share the detail of the current error?

Python 2/3 should be supported in release 3.29 I think.

wuxu92 avatar Oct 25 '22 05:10 wuxu92

@katbyte looks like these two PRs with the wrong release version, they should be released in 3.29.0? 3.28.0 was released on (October 20, 2022) but these two merged on Oct. 22.

wuxu92 avatar Oct 25 '22 05:10 wuxu92

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[bot] avatar Nov 25 '22 02:11 github-actions[bot]