microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
372 stars 260 forks source link

Feature/service principal entitlements #1028

Open nyanhp opened 2 months ago

nyanhp commented 2 months ago

All Submissions:

What about the current behavior has changed?

Added new resource azuredevops_service_principal_entitlement to handle service principal entitlements. The API threw errors when attempting to use a principal name to add the principal, so I only implemented the use of origin and origin_id.

Issue Number: #1025 #797 #889

Does this introduce a change to go.mod, go.sum or vendor/?

Does this introduce a breaking change?

Any relevant logs, error output, etc?

jhp@S1-0666-W:~/azdotest$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azuredevops_service_principal_entitlement.entitlement will be created
  + resource "azuredevops_service_principal_entitlement" "entitlement" {
      + account_license_type = "express"
      + descriptor           = (known after apply)
      + id                   = (known after apply)
      + licensing_source     = "account"
      + origin               = "aad"
      + origin_id            = "0f3bc8a7-70d6-471a-8224-1419cbfdf862"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

azuredevops_service_principal_entitlement.entitlement: Creating...
azuredevops_service_principal_entitlement.entitlement: Creation complete after 2s [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
jhp@S1-0666-W:~/azdotest$ terraform apply --destroy --auto-approve
azuredevops_service_principal_entitlement.entitlement: Refreshing state... [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # azuredevops_service_principal_entitlement.entitlement will be destroyed
  - resource "azuredevops_service_principal_entitlement" "entitlement" {
      - account_license_type = "express" -> null
      - descriptor           = "aadsp.NTgzNTAxYTMtM2VhNS03ZTBkLTgzMjktNTJjOTVlZDk4NmEx" -> null
      - id                   = "583501a3-3ea5-6e0d-8329-52c95ed986a1" -> null
      - licensing_source     = "account" -> null
      - origin               = "aad" -> null
      - origin_id            = "0f3bc8a7-70d6-471a-8224-1419cbfdf862" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.
azuredevops_service_principal_entitlement.entitlement: Destroying... [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]
azuredevops_service_principal_entitlement.entitlement: Destruction complete after 1s

Apply complete! Resources: 0 added, 0 changed, 1 destroyed.
jhp@S1-0666-W:~/azdotest$

azuredevops_service_principal_entitlement.entitlement: Refreshing state... [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azuredevops_service_principal_entitlement.entitlement will be updated in-place
  ~ resource "azuredevops_service_principal_entitlement" "entitlement" {
      ~ account_license_type = "express" -> "Stakeholder"
        id                   = "583501a3-3ea5-6e0d-8329-52c95ed986a1"
        # (4 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
azuredevops_service_principal_entitlement.entitlement: Modifying... [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]
azuredevops_service_principal_entitlement.entitlement: Modifications complete after 1s [id=583501a3-3ea5-6e0d-8329-52c95ed986a1]

Other information