microsoft / terraform-provider-power-platform

Power Platform Terraform Provider
https://registry.terraform.io/providers/microsoft/power-platform/latest/docs
MIT License
35 stars 13 forks source link

The resource "powerplatform_environment" does not support the "Enable Dynamics 365 apps" option #445

Closed webstean closed 1 month ago

webstean commented 2 months ago

Description

The resource "powerplatform_environment" does not support the "Enable Dynamics 365 apps" option, which has dependencies on Dynamics 365 licensing. Not sure how this would work if the environment is created via a Service Principle (who cannot be assigned a license).

Note: This option cannot be turned off once set, so cannot be updated once the environment is created.   Create Environment - Portal with Dynamics 365 Apps

Resource

resource "powerplatform_environment" "development" {
  display_name     = "example_environment"
  location         = "europe"
  azure_region     = "northeurope"
  environment_type = "Sandbox"
  dataverse = {
    enable_dynamics_365_apps = true
    language_code     = "1033"
    currency_code     = "USD"
    domain            = "mydomain"
    security_group_id = "00000000-0000-0000-0000-000000000000"
  }
}

Definition of Done

Contributions

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

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

mattdot commented 1 month ago

This flag just uses an environment template if you only check the flag and don't choose a sku this uses the D365_DeveloperEdition template. @eduardodfmex will provide an example of the terraform.

eduardodfmex commented 1 month ago

@webstean you can enable D365 apps with the resource "powerplatform_environment" dataverse templates, this will be a example:

terraform {
  required_providers {
    powerplatform = {
      source = "microsoft/power-platform"
    }
  }
}

provider "powerplatform" {
  use_cli = true
}

resource "powerplatform_environment" "development" {
  display_name     = "example_environment"
  location         = "europe"
  azure_region     = "northeurope"
  environment_type = "Sandbox"
  dataverse = {
    language_code     = "1033"
    currency_code     = "USD"
    domain            = "mydomain"
    security_group_id = "00000000-0000-0000-0000-000000000000"
    templates         = ["D365_CustomerService", "D365_FieldService", "D365_Sales"]
  }
  lifecycle {
    prevent_destroy = true
  }
}

The list of D365 apps templates will depend on your requirements and licensing.

mattdot commented 1 month ago

Closing this issue since there is already a way to achieve this.