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_api_management: Deploy APIM in a vnet #5494

Closed
wants to merge 1 commit into from

Conversation

pacon-vib
Copy link

Long time user, first time contributor. This PR exposes the existing functionality in the Azure SDK to tell an API Management (APIM) service that it needs to live in a vnet, in either internal or external mode. In a vnet in internal mode, we need to export the service's private IP address so that we can create DNS records pointing to it, so this PR does that too.

I'm posting this just to get some early 👀 on it to check I'm on the right track, but I believe I have some more things to do before this is ready to merge. Here's my TODO list, please let me know if there's anything I've missed:

  • Add documentation for new properties
  • Modify test cases to set and read new properties

I'm pretty sure virtualNetworkTypeStringToType() is less elegant than it could be, and may not accord with naming conventions, so I'd be grateful for your suggestions. I'm still finding my way around all the helper functions (and around Golang itself), so any pointers would be helpful.

@ghost ghost added the size/S label Jan 23, 2020
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @pacon-vib,

Thank you for the PR! A couple things that need to be addressed before we merge:

  • Could we support the other values?
  • put them all into their own block?
  • ensure we read all the values in on read
  • add them to the complete & update tests
  • update the docs

@@ -514,6 +537,12 @@ func resourceArmApiManagementServiceCreateUpdate(d *schema.ResourceData, meta in
CustomProperties: customProperties,
Certificates: certificates,
HostnameConfigurations: hostnameConfigurations,
VirtualNetworkType: virtualNetworkTypeStringToType(utils.String(d.Get("vnet_type").(string))),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should be able to go

Suggested change
VirtualNetworkType: virtualNetworkTypeStringToType(utils.String(d.Get("vnet_type").(string))),
VirtualNetworkType: apimanagement.VirtualNetworkType(d.Get("vnet_type").(string))),

@@ -62,6 +62,14 @@ func resourceArmApiManagementService() *schema.Resource {
},
},

"private_ip_addresses": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we put computed values at the end of the block?

Comment on lines +542 to +543
Vnetid: utils.String(""),
Subnetname: utils.String(""),
Copy link
Collaborator

Choose a reason for hiding this comment

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

COuld we also support these two values?

@@ -657,6 +686,7 @@ func resourceArmApiManagementServiceRead(d *schema.ResourceData, meta interface{
d.Set("management_api_url", props.ManagementAPIURL)
d.Set("scm_url", props.ScmURL)
d.Set("public_ip_addresses", props.PublicIPAddresses)
d.Set("private_ip_addresses", props.PrivateIPAddresses)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should we reading in the other new values here too

@@ -62,6 +62,14 @@ func resourceArmApiManagementService() *schema.Resource {
},
},

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we put these new values into a virtual_network block?

@tombuildsstuff
Copy link
Member

hey @pacon-vib

Thanks for this PR :)

Since we've not heard back from you here and another PR's been opened which also adds support for Virtual Networks to API Management (but which contains some of the changes mentioned above) - I hope you don't mind but I'm going to close this in favour of #5769.

Thanks!

@ghost
Copy link

ghost commented Mar 28, 2020

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!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 28, 2020
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.

None yet

3 participants