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

apimanagement: make description field required #14073

Closed

Conversation

Victorp99
Copy link
Contributor

Summary
This pull request makes the Description field required for the azurerm_api_management_product resource.

Fixes: #13856

Output from acceptance testing:

$ make acctests SERVICE='apimanagement' TESTARGS='-run="^TestAccApiManagementProduct_"'
==> 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/apimanagement -run="^TestAccApiManagementProduct_" -timeout 180m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccApiManagementProduct_basic
=== PAUSE TestAccApiManagementProduct_basic
=== RUN   TestAccApiManagementProduct_requiresImport
=== PAUSE TestAccApiManagementProduct_requiresImport
=== RUN   TestAccApiManagementProduct_update
=== PAUSE TestAccApiManagementProduct_update
=== RUN   TestAccApiManagementProduct_subscriptionsLimit
=== PAUSE TestAccApiManagementProduct_subscriptionsLimit
=== RUN   TestAccApiManagementProduct_complete
=== PAUSE TestAccApiManagementProduct_complete
=== RUN   TestAccApiManagementProduct_approvalRequiredError
=== PAUSE TestAccApiManagementProduct_approvalRequiredError
=== CONT  TestAccApiManagementProduct_basic
=== CONT  TestAccApiManagementProduct_complete
=== CONT  TestAccApiManagementProduct_approvalRequiredError
=== CONT  TestAccApiManagementProduct_update
=== CONT  TestAccApiManagementProduct_requiresImport
=== CONT  TestAccApiManagementProduct_subscriptionsLimit
--- PASS: TestAccApiManagementProduct_approvalRequiredError (253.04s)
--- PASS: TestAccApiManagementProduct_basic (288.47s)
--- PASS: TestAccApiManagementProduct_complete (349.35s)
--- PASS: TestAccApiManagementProduct_subscriptionsLimit (350.10s)
--- PASS: TestAccApiManagementProduct_update (449.63s)
--- PASS: TestAccApiManagementProduct_requiresImport (499.81s)
PASS
ok  	github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement	499.832s

@katbyte
Copy link
Collaborator

katbyte commented Nov 5, 2021

Hello @Victorp99 - thank you for this PR, while the portal does seem to mark this property as required these tests are currently passing without a description being passed. Thus i'm not sure this property needs to be required?

@Victorp99
Copy link
Contributor Author

Hello @katbyte! I updated all of the tests that had the azurerm_api_management_product resource within the apimanagement service to include a description. Are there other tests that I missed that include this resource that is passing without a description?

@Victorp99
Copy link
Contributor Author

I think I misunderstood your question initially. I did not submit the issue this PR addresses, but this fix would allow for a similar user experience when provisioning this resource whether it be via the Portal or Terraform.

@katbyte
Copy link
Collaborator

katbyte commented Nov 6, 2021

It's more that it doesn't appear to be broken in terraform? from our nightly tests i can see these tests pass just fine

image

@Victorp99
Copy link
Contributor Author

It looks like the API endpoint used by the Azure SDK for Go utilized by Terraform does not require a value for the Description field, which explains why the tests currently don't fail when omitted. https://docs.microsoft.com/en-us/rest/api/apimanagement/2020-12-01/product/create-or-update. I also have verified that the behavior is the same when using ARM templates. Based on this, we will probably not want to not move forward with this change in order to be in line with the consistent management layer put in place by the Azure Resource Manager service. https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/overview

When looking through the documentation, I did find that the subscription_required field is required when it shouldn't be based on Azure's documentation. I can create a new issue in order to address this inconsistency between the Azure documentation and Terraform implementation and fix it.

@katbyte
Copy link
Collaborator

katbyte commented Nov 10, 2021

Thanks for looking into it in more detail @Victorp99 - will close this as requested

@katbyte katbyte closed this Nov 10, 2021
@Victorp99
Copy link
Contributor Author

Thank you for reviewing my PR!

@Victorp99 Victorp99 deleted the api-management-product-description branch November 10, 2021 06:22
@github-actions
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 Dec 11, 2021
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.

Product Description Mandatory Field in azurerm_api_management_product
2 participants