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

API Management Product Not Setting Attributes #3105

Closed
simongh opened this issue Mar 22, 2019 · 5 comments
Closed

API Management Product Not Setting Attributes #3105

simongh opened this issue Mar 22, 2019 · 5 comments

Comments

@simongh
Copy link
Contributor

simongh commented Mar 22, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform 0.11.11
AzureRm 1.23.0

Affected Resource(s)

  • azurerm_api_management_product

Terraform Configuration Files

resource "azurerm_api_management_product" "my_cool_product" {
  product_id = "my-cool-product"
  api_management_name = "${azurerm_api_management.api.name}"
  resource_group_name = "${azurerm_api_management.api.resource_group_name}"
  display_name = "My Cool API"
  subscription_required = true
  approval_required = true
  published = true
}

Debug Output

n/a

Panic Output

n/a

Expected Behavior

The approval required should be set

Actual Behavior

Everytime you deploy this:

Terraform will perform the following actions:

  ~ azurerm_api_management_product.my_cool_product
      approval_required: "false" => "true"

Steps to Reproduce

Create a api management resource
Add a product as above

  1. terraform apply

Important Factoids

References

  • #0000
@Lucretius
Copy link
Contributor

Lucretius commented Mar 22, 2019

@simongh

Looking at the code, there is this check:

	if subscriptionRequired && subscriptionsLimit > 0 {
		properties.ProductContractProperties.ApprovalRequired = utils.Bool(approvalRequired)
		properties.ProductContractProperties.SubscriptionsLimit = utils.Int32(int32(subscriptionsLimit))
	}

However, subscriptions_limit is optional, and will default to the zero value if not set so the check will fail and approval_required will never get set. Could you try setting subscriptions_limit to be > 0 and re-applying to see if this solves the problem? If so, I can update the documentation to make this requirement obvious - or - if it is not necessary, fix the code to remove this restriction.

@simongh
Copy link
Contributor Author

simongh commented Mar 25, 2019

@Lucretius That worked. Setting the subscriptions limit caused it to set the attribute correctly

@Lucretius
Copy link
Contributor

Great - I’ll update the documentation accordingly

@mbfrahry
Copy link
Member

Hey @simongh, we've added validation to prevent this specific interaction from happening. It'll come out in the next release (1.32.1) and feel free to reopen this issue if you continue to see this.

@ghost
Copy link

ghost commented Aug 26, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants