-
Notifications
You must be signed in to change notification settings - Fork 271
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
New Resource azuredevops_service_principal_entitlement
#1028
base: main
Are you sure you want to change the base?
New Resource azuredevops_service_principal_entitlement
#1028
Conversation
Remove unused list of keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyanph can you add the AccTest for the new resources?
## Argument Reference | ||
|
||
- `origin_id` - (Required) The object ID of the enterprise application. | ||
- `origin` - (Optional) The type of source provider for the origin identifier. Defaults to `aad`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any other possible values besides the default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. The docs say AAD, AD, MSA, but I'm not sure if that list is exhaustive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add AD
, AAD
, MSA
to the doc
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
|
||
func flattenServicePrincipalEntitlement(d *schema.ResourceData, servicePrincipalEntitlement *memberentitlementmanagement.ServicePrincipalEntitlement) { | ||
d.SetId(servicePrincipalEntitlement.Id.String()) | ||
d.Set("descriptor", *servicePrincipalEntitlement.ServicePrincipal.Descriptor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the servicePrincipalEntitlement.ServicePrincipal.Descriptor
and servicePrincipalEntitlement.ServicePrincipal
first before get the values to prevent potential nil exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the request. The check is done in l126, before the function is called. I can repeat the same check within the function and throw an error if that is the correct way to do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service may not return the property due to permission. Therefore, you need to check this property before calling it with a pointer.
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
azuredevops_service_principal_entitlement
Co-authored-by: xuzhang3 <[email protected]>
Co-authored-by: xuzhang3 <[email protected]>
Co-authored-by: xuzhang3 <[email protected]>
Co-authored-by: xuzhang3 <[email protected]>
…rce_service_principal_entitlement.go Co-authored-by: xuzhang3 <[email protected]>
…rce_service_principal_entitlement.go Co-authored-by: xuzhang3 <[email protected]>
…rce_service_principal_entitlement.go Co-authored-by: xuzhang3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some AccTest to cover the usage scenarios?
Refs:
https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests
https://github.com/microsoft/terraform-provider-azuredevops/blob/main/azuredevops/internal/acceptancetests/resource_group_entitlement_test.go
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
|
||
func flattenServicePrincipalEntitlement(d *schema.ResourceData, servicePrincipalEntitlement *memberentitlementmanagement.ServicePrincipalEntitlement) { | ||
d.SetId(servicePrincipalEntitlement.Id.String()) | ||
d.Set("descriptor", *servicePrincipalEntitlement.ServicePrincipal.Descriptor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service may not return the property due to permission. Therefore, you need to check this property before calling it with a pointer.
...evops/internal/service/memberentitlementmanagement/resource_service_principal_entitlement.go
Outdated
Show resolved
Hide resolved
I am not that good with Go to be honest, so I'm afraid I can't do that properly. |
Co-authored-by: xuzhang3 <[email protected]>
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
orvendor/
?Does this introduce a breaking change?
Any relevant logs, error output, etc?
Other information