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

azurerm_cognitive_account: allows bypass property for network_acls #28221

Merged

Conversation

feliperezende-barbosa
Copy link
Contributor

@feliperezende-barbosa feliperezende-barbosa commented Dec 9, 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

This PR implements the network_acls.bypass property for azurerm_coginitive_account. Azure Services for Azure OpenAI

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)
==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/cognitive -run=TestAccCognitiveAccount_networkAcls -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== RUN   TestAccCognitiveAccount_networkAcls
=== PAUSE TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== CONT  TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported (137.85s)
--- PASS: TestAccCognitiveAccount_networkAcls (216.38s)
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRules (226.20s)
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass (258.18s)
PASS
ok  	github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive	259.848s

Change Log

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

  • azurerm_cognitive_account - support for the bypass trusted Azure Services property [GH-28221]

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 #28304

Note

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

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks for this @feliperezende-barbos. This is looking good so far. Could we also add additional test steps to set this to AzureServices and back to None so we can confirm that updating this property works as expected? Thanks!

@feliperezende-barbosa
Copy link
Contributor Author

feliperezende-barbosa commented Dec 18, 2024

Thanks for this @feliperezende-barbos. This is looking good so far. Could we also add additional test steps to set this to AzureServices and back to None so we can confirm that updating this property works as expected? Thanks!

Sure, I just added one more validation test for bypass property to back from AzureServices to None. Thanks.

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks for updating the tests @feliperezende-barbosa. I had a look at the results and it appears we have a failure, but once that is addressed I can take another look. Thanks!

------- Stdout: -------
=== RUN   TestAccCognitiveAccount_networkAcls
=== PAUSE TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAcls
    testcase.go:173: Step 1/6 error: Error running apply: exit status 1
        Error: creating Account (Subscription: "*******"
        Resource Group Name: "acctestRG-cognitive-241219155302861835"
        Account Name: "acctestcogacc-241219155302861835"): unexpected status 400 (400 Bad Request) with error: NetworkAclsBypassNotSupported: The Kind 'Face' does not support Trusted Services.
          with azurerm_cognitive_account.test,
          on terraform_plugin_test.tf line 68, in resource "azurerm_cognitive_account" "test":
          68: resource "azurerm_cognitive_account" "test" {
--- FAIL: TestAccCognitiveAccount_networkAcls (177.11s)
FAIL

@feliperezende-barbosa
Copy link
Contributor Author

feliperezende-barbosa commented Dec 19, 2024

Thanks for updating the tests @feliperezende-barbosa. I had a look at the results and it appears we have a failure, but once that is addressed I can take another look. Thanks!

------- Stdout: -------
=== RUN   TestAccCognitiveAccount_networkAcls
=== PAUSE TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAcls
    testcase.go:173: Step 1/6 error: Error running apply: exit status 1
        Error: creating Account (Subscription: "*******"
        Resource Group Name: "acctestRG-cognitive-241219155302861835"
        Account Name: "acctestcogacc-241219155302861835"): unexpected status 400 (400 Bad Request) with error: NetworkAclsBypassNotSupported: The Kind 'Face' does not support Trusted Services.
          with azurerm_cognitive_account.test,
          on terraform_plugin_test.tf line 68, in resource "azurerm_cognitive_account" "test":
          68: resource "azurerm_cognitive_account" "test" {
--- FAIL: TestAccCognitiveAccount_networkAcls (177.11s)
FAIL

I realized you had tested the TestAccCognitiveAccount_networkAcls instead of TestAccCognitiveAccount_networkAclsVirtualNetworkRules. The problem was caused because the bypass property works for the Kind OpenAI and not for the Kind Face as you can see in the error: Account Name: "acctestcogacc-241219155302861835"): unexpected status 400 (400 Bad Request) with error: NetworkAclsBypassNotSupported: The Kind 'Face' does not support Trusted Services. That's why I've changed the Kind from Face to OpenAI in TestAccCognitiveAccount_networkAclsVirtualNetworkRules. You can check it out in this link.
I fixed the TestAccCognitiveAccount_networkAcls because both tests are related.
I've updated the PR in Testing section with the test results I've performed for both scenarios.

@catriona-m
Copy link
Member

Thanks for updating the tests @feliperezende-barbosa. I had a look at the results and it appears we have a failure, but once that is addressed I can take another look. Thanks!

------- Stdout: -------
=== RUN   TestAccCognitiveAccount_networkAcls
=== PAUSE TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAcls
    testcase.go:173: Step 1/6 error: Error running apply: exit status 1
        Error: creating Account (Subscription: "*******"
        Resource Group Name: "acctestRG-cognitive-241219155302861835"
        Account Name: "acctestcogacc-241219155302861835"): unexpected status 400 (400 Bad Request) with error: NetworkAclsBypassNotSupported: The Kind 'Face' does not support Trusted Services.
          with azurerm_cognitive_account.test,
          on terraform_plugin_test.tf line 68, in resource "azurerm_cognitive_account" "test":
          68: resource "azurerm_cognitive_account" "test" {
--- FAIL: TestAccCognitiveAccount_networkAcls (177.11s)
FAIL

I realized you had tested the TestAccCognitiveAccount_networkAcls instead of TestAccCognitiveAccount_networkAclsVirtualNetworkRules. The problem was caused because the bypass property works for the Kind OpenAI and not for the Kind Face as you can see in the error: Account Name: "acctestcogacc-241219155302861835"): unexpected status 400 (400 Bad Request) with error: NetworkAclsBypassNotSupported: The Kind 'Face' does not support Trusted Services. That's why I've changed the Kind from Face to OpenAI in TestAccCognitiveAccount_networkAclsVirtualNetworkRules. You can check it out in this link. I fixed the TestAccCognitiveAccount_networkAcls because both tests are related. I've updated the PR in Testing section with the test results I've performed for both scenarios.

Thanks for your reply @feliperezende-barbosa. My concern is that adding this property seems to be affecting existing configurations which are not using the bypass property and which previously worked without error beforehand. Would you be able to take another look at fixing this up? Thanks!

@feliperezende-barbosa
Copy link
Contributor Author

feliperezende-barbosa commented Jan 9, 2025

Thanks @catriona-m, it had the risk of affecting the existing configurations that are not using and do not support it. I've added more tests and one more validating an error that does not support the bypass property. Could you please take a look again? Thanks again.

Results of the tests:

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test -v ./internal/services/cognitive -run=TestAccCognitiveAccount_networkAcls -timeout 60m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
=== RUN   TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== PAUSE TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== RUN   TestAccCognitiveAccount_networkAcls
=== PAUSE TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRules
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported
=== CONT  TestAccCognitiveAccount_networkAcls
=== CONT  TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypassKindNotSupported (137.85s)
--- PASS: TestAccCognitiveAccount_networkAcls (216.38s)
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRules (226.20s)
--- PASS: TestAccCognitiveAccount_networkAclsVirtualNetworkRulesWithBypass (258.18s)
PASS
ok  	github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive	259.848s

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks for updating this @feliperezende-barbosa - I have left one query inline but I can take another look once that is addressed. Thanks!

@catriona-m
Copy link
Member

catriona-m commented Jan 15, 2025

Thanks for updating this @feliperezende-barbosa - I have left one query inline but I can take another look once that is addressed. Thanks!

Hi @catriona-m, I cannot see any query inline. Could you please check this out? Thanks

Sorry about that @feliperezende-barbosa - not sure how it got lost, but I've added the comment again now!

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks for updating this @feliperezende-barbosa - I had another look through and left a couple more suggestions for you to consider, let me know what you think. Thanks!

@feliperezende-barbosa
Copy link
Contributor Author

Thanks for updating this @feliperezende-barbosa - I had another look through and left a couple more suggestions for you to consider, let me know what you think. Thanks!

Thanks for the suggestions. I've applied them.

Copy link
Member

@catriona-m catriona-m left a comment

Choose a reason for hiding this comment

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

Thanks for making the requested changes on this @feliperezende-barbosa - LGTM!

@catriona-m catriona-m merged commit ecd9c2b into hashicorp:main Jan 28, 2025
33 checks passed
@github-actions github-actions bot added this to the v4.17.0 milestone Jan 28, 2025
catriona-m added a commit that referenced this pull request Jan 28, 2025
jackofallops added a commit that referenced this pull request Jan 31, 2025
* Update for #27950

* Update for #27824

* Update for #28592 #28583 #28599 #28590 #28453

* Update #28528

* Update for #27853

* Update CHANGELOG.md #28221

* Update for #27760

* Update CHANGELOG.md #28480

* Update CHANGELOG.md typo

* Update CHANGELOG.md #28372

* Update CHANGELOG.md for #26047

also alphabetised ENHANCEMENTS

* Update for #28146

* Update CHANGELOG.md #28013

* Update CHANGELOG.md for #28492

* Update CHANGELOG.md for #28648

* Update CHANGELOG.md for #28549

* Update for #28469 #28620

* prep for release

* i touched it last

---------

Co-authored-by: catriona-m <[email protected]>
Co-authored-by: jackofallops <[email protected]>
Co-authored-by: sreallymatt <[email protected]>
Co-authored-by: Matthew Frahry <[email protected]>
Co-authored-by: jackofallops <[email protected]>
hqhqhqhqhqhqhqhqhqhqhq pushed a commit to hqhqhqhqhqhqhqhqhqhqhq/terraform-provider-azurerm that referenced this pull request Feb 26, 2025
* Update for hashicorp#27950

* Update for hashicorp#27824

* Update for hashicorp#28592 hashicorp#28583 hashicorp#28599 hashicorp#28590 hashicorp#28453

* Update hashicorp#28528

* Update for hashicorp#27853

* Update CHANGELOG.md hashicorp#28221

* Update for hashicorp#27760

* Update CHANGELOG.md hashicorp#28480

* Update CHANGELOG.md typo

* Update CHANGELOG.md hashicorp#28372

* Update CHANGELOG.md for hashicorp#26047

also alphabetised ENHANCEMENTS

* Update for hashicorp#28146

* Update CHANGELOG.md hashicorp#28013

* Update CHANGELOG.md for hashicorp#28492

* Update CHANGELOG.md for hashicorp#28648

* Update CHANGELOG.md for hashicorp#28549

* Update for hashicorp#28469 hashicorp#28620

* prep for release

* i touched it last

---------

Co-authored-by: catriona-m <[email protected]>
Co-authored-by: jackofallops <[email protected]>
Co-authored-by: sreallymatt <[email protected]>
Co-authored-by: Matthew Frahry <[email protected]>
Co-authored-by: jackofallops <[email protected]>
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 Feb 28, 2025
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.

azurerm_cognitive_account - NetworkRuleSet support for bypass
2 participants