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

Update NGINXaaS API: 2024-09-01-preview #27776

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

puneetsarna
Copy link
Contributor

@puneetsarna puneetsarna commented Oct 26, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_resource - support for the thing1 property [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@puneetsarna
Copy link
Contributor Author

puneetsarna commented Oct 26, 2024

Depends on #27775. Will rebase and pull latest main once the latest SDK is in.

@puneetsarna
Copy link
Contributor Author

Need to fix up property deprecation.

@puneetsarna
Copy link
Contributor Author

puneetsarna commented Oct 28, 2024

This is a rough/incomplete draft for now. CC @stephybun (Based on our discussion, this needs to be chatted about within the Terraform team before we move forward with this work).

@puneetsarna puneetsarna force-pushed the ps-dev-nginx-2024-09-01 branch from 865c786 to 3870172 Compare November 6, 2024 13:33
@puneetsarna puneetsarna marked this pull request as ready for review November 6, 2024 13:44
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Hey @puneetsarna

Before I dive into a detailed review here, I noticed that the acceptance tests for the configuration resource begun failing from the 15th of October. There is a related PR open that attempts to fix this but it seems there are some issues around testing here.

This test passing is a pre-requisite to reviewing and merging this change since we rely on those to validate that the deprecation and changes in this PR have been done correctly and won't cause any additional issues or unexpected side effects for users.

Would you be able to work with the author of the PR linked above to get that test fixed?

@puneetsarna
Copy link
Contributor Author

Hey @puneetsarna

Before I dive into a detailed review here, I noticed that the acceptance tests for the configuration resource begun failing from the 15th of October. There is a related PR open that attempts to fix this but it seems there are some issues around testing here.

This test passing is a pre-requisite to reviewing and merging this change since we rely on those to validate that the deprecation and changes in this PR have been done correctly and won't cause any additional issues or unexpected side effects for users.

Would you be able to work with the author of the PR linked above to get that test fixed?

Thanks @stephybun I took a look at that PR and have left some comments. Can you help review it as well please? then we can start on this PR also?

@stephybun
Copy link
Member

@puneetsarna could you rebase this on top of main to pull in those nginx configuration test fixes?

@puneetsarna puneetsarna force-pushed the ps-dev-nginx-2024-09-01 branch from 3870172 to bb5ce8a Compare November 20, 2024 17:32
@puneetsarna
Copy link
Contributor Author

@puneetsarna could you rebase this on top of main to pull in those nginx configuration test fixes?

@stephybun Done 👍

@puneetsarna
Copy link
Contributor Author

@puneetsarna the tests look good, because we're making a breaking change behind the features.FivePointOhBeta flag the tests also need in pass in 5.0 mode which they're not. See failure below

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccConfiguration_withCertificate
=== PAUSE TestAccConfiguration_withCertificate
=== CONT  TestAccConfiguration_withCertificate
------- Stderr: -------
panic: Invalid address to set: []string{"managed_resource_group"}
goroutine 2356 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc003b34c00, {0x6f7e3d1, 0x16}, {0x7101740, 0xe530ba0})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc0008d2488, {0x8c6b880, 0xc003b73de8}, 0xc003b34c00, 0x0, {0x8c6b8b8, 0xe52e5c0}}, {0x6e02dc0, 0xc003b554a0})

I was missing the tag removedInNextMajorVersion on the managed_resource_group field. 👍

I ran the tests locally at 5.0 and they are passing now 👍

@puneetsarna puneetsarna force-pushed the ps-dev-nginx-2024-09-01 branch 2 times, most recently from 6a593c3 to 002563e Compare December 4, 2024 18:31
@puneetsarna puneetsarna force-pushed the ps-dev-nginx-2024-09-01 branch from 002563e to 0207626 Compare December 4, 2024 20:30
This commit updates the NGINXaaS API version to be
the latest: 2024-09-01-preview.
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @puneetsarna! There are still a few test failures in 5.0 mode, once those are fixed this should be good to go!

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxConfigurationDataSource_basic
=== PAUSE TestAccNginxConfigurationDataSource_basic
=== CONT  TestAccNginxConfigurationDataSource_basic
------- Stderr: -------
panic: Invalid address to set: []string{"protected_file", "0", "content"}
goroutine 2231 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc0029fbc80, {0x6ca2375, 0xe}, {0x6f80740, 0xc004f68b70})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc004e52488, {0x8c6ca20, 0xc001ed4678}, 0xc0029fbc80, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03c40, 0xc00421d6e0})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*ConfigurationDataSource).Read.ConfigurationDataSource.Read.func1({0x8c6c898, 0xc005137180}, {0xc004e52488, {0x8c6ca20, 0xc001ed4678}, 0xc0029fbc80, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_configuration_data_source.go:163 +0x5b3
Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxDeploymentDataSource_basic
=== PAUSE TestAccNginxDeploymentDataSource_basic
=== CONT  TestAccNginxDeploymentDataSource_basic
------- Stderr: -------
panic: Invalid address to set: []string{"managed_resource_group"}
goroutine 2163 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc003ed7100, {0x6f7f3d1, 0x16}, {0x7102740, 0xe531ba0})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc00252ed88, {0x8c6ca20, 0xc005a2f2f0}, 0xc003ed7100, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03d00, 0xc002a89040})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*DeploymentDataSource).Read.DeploymentDataSource.Read.func1({0x8c6c898, 0xc003e9f960}, {0xc00252ed88, {0x8c6ca20, 0xc005a2f2f0}, 0xc003ed7100, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_deployment_data_source.go:324 +0x898
Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxDeploymentDataSource_autoscaling
=== PAUSE TestAccNginxDeploymentDataSource_autoscaling
=== CONT  TestAccNginxDeploymentDataSource_autoscaling
------- Stderr: -------
panic: Invalid address to set: []string{"managed_resource_group"}
goroutine 2122 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc002bbac80, {0x6f7f3d1, 0x16}, {0x7102740, 0xe531ba0})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc004914908, {0x8c6ca20, 0xc0053f3680}, 0xc002bbac80, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03d00, 0xc002a6d900})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*DeploymentDataSource).Read.DeploymentDataSource.Read.func1({0x8c6c898, 0xc002835110}, {0xc004914908, {0x8c6ca20, 0xc0053f3680}, 0xc002bbac80, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_deployment_data_source.go:324 +0x898

…ntent of protected_files

The service provider has never returned the
contents of a protected file in the API response.
The latest swagger splits up the request,response
objects on protected files, and this commit
incorporates the swagger change while deprecating
the `content` field on the protect file wherever
we do a READ on it.
This field was deprecated by the service provider
a long time back. This commit just deprectes the
same field in terrform in the next provider
version.
The provider upgrade guide needs to be updated to
call out deprecated fields that will be removed in
5.0.
- Updates to docs to remove deprecated properties.
@puneetsarna puneetsarna force-pushed the ps-dev-nginx-2024-09-01 branch from ebad301 to 5f4f2ad Compare December 5, 2024 18:27
@puneetsarna
Copy link
Contributor Author

Thanks @puneetsarna! There are still a few test failures in 5.0 mode, once those are fixed this should be good to go!

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxConfigurationDataSource_basic
=== PAUSE TestAccNginxConfigurationDataSource_basic
=== CONT  TestAccNginxConfigurationDataSource_basic
------- Stderr: -------
panic: Invalid address to set: []string{"protected_file", "0", "content"}
goroutine 2231 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc0029fbc80, {0x6ca2375, 0xe}, {0x6f80740, 0xc004f68b70})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc004e52488, {0x8c6ca20, 0xc001ed4678}, 0xc0029fbc80, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03c40, 0xc00421d6e0})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*ConfigurationDataSource).Read.ConfigurationDataSource.Read.func1({0x8c6c898, 0xc005137180}, {0xc004e52488, {0x8c6ca20, 0xc001ed4678}, 0xc0029fbc80, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_configuration_data_source.go:163 +0x5b3
Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxDeploymentDataSource_basic
=== PAUSE TestAccNginxDeploymentDataSource_basic
=== CONT  TestAccNginxDeploymentDataSource_basic
------- Stderr: -------
panic: Invalid address to set: []string{"managed_resource_group"}
goroutine 2163 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc003ed7100, {0x6f7f3d1, 0x16}, {0x7102740, 0xe531ba0})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc00252ed88, {0x8c6ca20, 0xc005a2f2f0}, 0xc003ed7100, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03d00, 0xc002a89040})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*DeploymentDataSource).Read.DeploymentDataSource.Read.func1({0x8c6c898, 0xc003e9f960}, {0xc00252ed88, {0x8c6ca20, 0xc005a2f2f0}, 0xc003ed7100, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_deployment_data_source.go:324 +0x898
Test ended in panic.
------- Stdout: -------
=== RUN   TestAccNginxDeploymentDataSource_autoscaling
=== PAUSE TestAccNginxDeploymentDataSource_autoscaling
=== CONT  TestAccNginxDeploymentDataSource_autoscaling
------- Stderr: -------
panic: Invalid address to set: []string{"managed_resource_group"}
goroutine 2122 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc002bbac80, {0x6f7f3d1, 0x16}, {0x7102740, 0xe531ba0})
  /opt/teamcity-agent/work/3337027aeff310bf/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource_data.go:233 +0x2b4
github.com/hashicorp/terraform-provider-azurerm/internal/sdk.ResourceMetaData.Encode({0xc004914908, {0x8c6ca20, 0xc0053f3680}, 0xc002bbac80, 0x0, {0x8c6ca58, 0xe52f5c0}}, {0x6e03d00, 0xc002a6d900})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/sdk/resource_encode.go:31 +0x247
github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx.(*DeploymentDataSource).Read.DeploymentDataSource.Read.func1({0x8c6c898, 0xc002835110}, {0xc004914908, {0x8c6ca20, 0xc0053f3680}, 0xc002bbac80, 0x0, {0x8c6ca58, 0xe52f5c0}})
  /opt/teamcity-agent/work/3337027aeff310bf/internal/services/nginx/nginx_deployment_data_source.go:324 +0x898

Thanks @stephybun. I had missed out on more removedInNextMajorVersion stuff. pushed up a fix for it and tests are passing with provider 5.0:

TF_ACC=1 go test -v ./internal/services/nginx -run=TestAccNginxConfigurationDataSource_basic -timeout 180m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccNginxConfigurationDataSource_basic
=== PAUSE TestAccNginxConfigurationDataSource_basic
=== CONT  TestAccNginxConfigurationDataSource_basic


--- PASS: TestAccNginxConfigurationDataSource_basic (439.64s)
PASS
ok  	github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx	442.521s

-------------------------------------------------------------------------------------------------
=== CONT  TestAccNginxDeploymentDataSource_basic
--- PASS: TestAccNginxDeploymentDataSource_basic (405.34s)
--- PASS: TestAccNginxDeploymentDataSource_autoscaling (393.13s)
PASS

@puneetsarna puneetsarna requested a review from stephybun December 5, 2024 19:30
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @puneetsarna LGTM 👍

@stephybun stephybun merged commit 8f0d6be into hashicorp:main Dec 9, 2024
33 checks passed
@github-actions github-actions bot added this to the v4.14.0 milestone Dec 9, 2024
stephybun added a commit that referenced this pull request Dec 9, 2024
jackofallops added a commit that referenced this pull request Dec 13, 2024
* Update CHANGELOG.md for #26304

* Update CHANGELOG.md for #28211

* Update for #28016

* Update for #28139

* Update for #27776

* Update for #28227

* Update for #28080

* Update for #28228

* Update for #27915

* reword nginx api upgrade

* Update for #28160

* Update for #28043

* run changelog-update-for-release.sh

---------

Co-authored-by: stephybun <steph@hashicorp.com>
Co-authored-by: kt <kt@katbyte.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants