-
Notifications
You must be signed in to change notification settings - Fork 301
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
Initial support for Microsoft Graph with opt-in beta #373
Conversation
66a9a37
to
33946d2
Compare
0d4a908
to
e06f028
Compare
7e061a3
to
3a9c0a4
Compare
34c6ac0
to
14b1fa8
Compare
d690b7a
to
9225d08
Compare
c505e72
to
6f7c4d8
Compare
9225d08
to
5dc0f38
Compare
6f7c4d8
to
6ea7423
Compare
439ac7f
to
8e0e9c2
Compare
f228887
to
1ab05ac
Compare
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.
a few minor comments but this otherwise LGTM 👍
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
*No additional attributes are exported* |
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.
The ID will be?
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 have tried to avoid mentioning the resource ID too much as it's a frequent source of confusion - instead there are contextual attributes like scope_id
in this case.
internal/services/applications/application_password_resource.go
Outdated
Show resolved
Hide resolved
var status int | ||
for _, owner := range *group.Owners { | ||
// don't fail if an owner already exists | ||
checkOwnerAlreadyExists := func(resp *http.Response, o *odata.OData) bool { |
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.
wouldn't this indicate a bug?
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.
This mostly helps to work around API inconsistency where newly created groups (and other objects) sometimes inherit an owner but sometimes don't. Also the group read operation has inconsistencies where owners sometimes take awhile to show up after adding, this helps work around that without excessive/fruitless retry logic in the calling app.
} | ||
|
||
// despite the above check, sometimes owners are just gone | ||
checkOwnerGone := func(resp *http.Response, o *odata.OData) bool { |
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.
(as above) wouldn't this indicate a bug?
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.
Similarly sometimes the read operation on a group indicates the presence of an owner when it's actually already been removed, so you end up with a GET showing an owner, but DELETEing that owner gets you a 403.
if err := json.Unmarshal(data, &e); err != nil { | ||
return err | ||
} | ||
for _, k := range []string{"error", "odata.error"} { |
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 this also be in @odata.error
?
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 haven't seen that but maybe? AFAICT @odata.error
isn't in the odata standard, although I think i'd probably expect it to have astring value if it showed up anywhere.
…ice_principal_password For both resources: - Since `value` is to be removed, generate a value for AAD Graph if one is not specified in configuration, mimicking characteristics of msgraph-generated passwords - As `end_date` / `end_date_relative` are also being removed, default `end_date_relative` to 17520h (2 years) which mimics MS Graph
c70a8bc
to
ebaf2ab
Compare
ebaf2ab
to
b2de421
Compare
Great work! |
😁🎉🚀💐🥇⭐️🙌🥳 |
This has been released in version 1.5.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azuread" {
version = "~> 1.5.0"
}
# ... other configuration ... |
Awesome work! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR introduces support for Microsoft Graph using https://github.com/manicminer/hamilton, alongside the existing Azure Active Directory Graph API implementation, and aims to maintain forward and backward compatibility. Users can opt-in to using MS Graph by setting the
use_microsoft_graph
provider attribute or theAAD_USE_MICROSOFT_GRAPH
environment variable.This is broken into multiple commits to aid review.
Authentication
Authentication for MS Graph is handled by hamilton/auth similarly to go-azure-helpers. Different auth methods can be configured and are tried in order, until one succeeds.
Authentication via hamilton/auth is only performed when MS Graph is enabled, to avoid erroring if no API permissions are granted to the principal.
Authentication via go-azure-helpers is always performed, even when MS Graph is enabled. Both methods must work for provider configuration to succeed. This will be removed in v2.0.
Client configuration is sourced from the AuthConfig supplied by go-azure-helpers. This will be switched in v2.0.
All national clouds are supported
The US Gov cloud is now two clouds in MS Graph - L4 and L5.
Resources
resource.StateChangeConf{}.WaitForState()
method usages have been removed since MS Graph has been observed to be consistent in most cases.Documentation