microsoft / power-platform-terraform-quickstarts

Examples for using the Power Platform Terraform Provider
https://github.com/microsoft/terraform-provider-power-platform
MIT License
21 stars 5 forks source link

Syntax for powerplatform_rest (Resource) to link VNet Enterprise policy to a PowerApp environment #125

Closed webstean closed 2 days ago

webstean commented 2 months ago

Description

Microsoft provides a Powershell script to link an VNET PowerApp Enterprise Policy to PowerApp environment, is it possible to have someone smarter than me convert this a powerplatform_rest call in Terraform using this provider?

Might also be a good test case, to ensure powerplatform_rest (Resource) has all the necessary capabilities to do this sort of thing.

Create Link Power Apps Enterprise Policy to an environment

Definition of Done

Contributions

Do you plan to raise a PR to address this issue? NO

See the contributing guide for more information about what's expected for contributions.

mattdot commented 1 month ago

Moving this issue to the quickstarts repo. I think this would be an excellent example

pawel-szon commented 2 weeks ago

Hey @webstean, here is the code I'm running:

resource "powerplatform_rest" "link_enterprise_policy" {
  create = {
    scope                = "https://api.bap.microsoft.com/.default"
    url                  = "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/${local.environment_id}/enterprisePolicies/NetworkInjection/link?&api-version=2019-10-01"
    method               = "POST"
    body                 = "{ 'SystemId' : '${local.enterprise_policy_systemId}'}"
    expected_http_status = [202]
  }

I hope this helps.

webstean commented 2 weeks ago

Thanks will try it out

mawasile commented 2 days ago

powerplatform_enterprise_policy is now added to main branch and will be released asap https://github.com/microsoft/terraform-provider-power-platform/commit/8385f36e46c484dd2a96c3838553519e4a853834

https://github.com/microsoft/terraform-provider-power-platform/tree/main/examples/resources/powerplatform_enterprise_policy