Skip to content
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

Add cloud identity group #3696

Merged
merged 16 commits into from
Jun 24, 2020

Conversation

megan07
Copy link
Contributor

@megan07 megan07 commented Jun 22, 2020

Fixes hashicorp/terraform-provider-google#3479

I've commented out a few un-implemented things (per email thread), but will update/include them as I hear back from the rest of the team.

Release Note Template for Downstream PRs (will be copied)

`google_cloud_identity_group` (TPGB-only)
added the `https://www.googleapis.com/auth/cloud-identity` scope to the provider by default

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 13 files changed, 129 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 971 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122165"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 13 files changed, 60 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 971 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122166"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 52 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 971 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122167"

@megan07 megan07 requested a review from danawillow June 22, 2020 21:02
products/cloudidentity/api.yaml Outdated Show resolved Hide resolved
products/cloudidentity/terraform.yaml Outdated Show resolved Hide resolved
@@ -1,7 +1,11 @@
// `name` is autogenerated from the api so needs to be set post-create
name, ok := res["name"]
if !ok {
return fmt.Errorf("Create response didn't contain critical fields. Create may not have succeeded.")
name, ok = res["response"].(map[string]interface{})["name"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an api response doesn't have "name" or "response" for whatever reason, wouldn't this be a nil ptr?

- !ruby/object:Api::Type::NestedObject
name: 'groupKey'
required: true
input: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should id and namespace also be marked input: true?

})
}

func testAccCloudIdentityGroup_basic(context map[string]interface{}) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as testAccCloudIdentityGroup_cloudIdentityGroupsBasicExample, right? want to just use that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes! I thought the random suffixes would be different between the two, but just tried it and it worked. Thanks!

@@ -17,5 +17,7 @@
"<%= var_name -%>": getTestProjectFromEnv(),
<% elsif var_type == :FIRESTORE_PROJECT_NAME -%>
"<%= var_name -%>": getTestFirestoreProjectFromEnv(t),
<% elsif var_type == :CUST_ID -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to add something to provider/terraform/examples.rb to get the cust_id to appear in the docs example


If specified, the EntityKey represents an external-identity-mapped group.
The namespace must correspond to an identity source created in Admin Console
and must be in the form of `identitysources/{identity_source_id}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and must be in the form of `identitysources/{identity_source_id}.
and must be in the form of `identitysources/{identity_source_id}`.

@@ -190,6 +190,7 @@ var <%= product[:definitions].name -%>DefaultBasePath = "<%= product[:definition
var defaultClientScopes = []string{
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-identity",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth adding a note to the changelog about this (we did last time: #2473)

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 52 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 971 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122393"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 52 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 971 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122393"

@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 1006 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 21 files changed, 1006 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122399"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 25 files changed, 1978 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122407"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 25 files changed, 1978 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122411"

resource: 'Group'
imports: 'name'
description: |
The name of the Group to create this membership.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The name of the Group to create this membership.
The name of the Group to create this membership in.

The resource name of the Membership, of the form groups/{group_id}/memberships/{membership_id}.
- !ruby/object:Api::Type::NestedObject
name: 'memberKey'
input: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here wrt input: true on id/namespace

and must be in the form of `identitysources/{identity_source_id}.
- !ruby/object:Api::Type::NestedObject
name: 'preferredMemberKey'
input: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

name: 'roles'
description: |
The MembershipRoles that apply to the Membership.
If unspecified, defaults to a single MembershipRole with name MEMBER.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true? It's not marked as computed. Or is it just not returned from the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After double-checking, this appears to not be true? I tried not including it and got an error, so I'm just going to mark this as required.

name: 'type'
output: true
description: |
# The type of the membership.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The type of the membership.
The type of the membership.


resource "google_cloud_identity_group_membership" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
group = google_cloud_identity_group.group.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


If specified, the EntityKey represents an external-identity-mapped group.
The namespace must correspond to an identity source created in Admin Console
and must be in the form of `identitysources/{identity_source_id}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and must be in the form of `identitysources/{identity_source_id}.
and must be in the form of `identitysources/{identity_source_id}`.

post_create: templates/terraform/post_create/set_computed_name.erb
GroupMembership: !ruby/object:Overrides::Terraform::ResourceOverride
import_format: ["{{name}}"]
examples:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's really similar, I think people would probably appreciate an example showing how to add a user in addition to the existing one for adding a child group.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I started with that, but the user has to exist, and I can't create that with terraform, I don't believe. Do you want me to put an example in that is skip_test: true and hard-code an example email?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the user have to be in the org in question? If not I think we have a bunch of tests that use various emails belonging to people (like Paddy)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it has to end with the org_domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the example in with skip_test, I tested it first with a user I created in our org, and it worked, so I'm confident it will work.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 25 files changed, 2016 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122425"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 25 files changed, 2087 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122432"

@megan07 megan07 requested a review from danawillow June 23, 2020 21:28
test_env_vars:
org_domain: :ORG_DOMAIN
cust_id: :CUST_ID
admin_user: :ADMIN_USER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do they have to be an admin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't believe so. i did this to separate that it has to be a user in admin console rather than a user in a project. maybe IDENTITY_USER might be more descriptive? i was trying to think on it last night, that's the best i could come up with.

parent = "customers/<%= ctx[:test_env_vars]['cust_id'] %>"

group_key {
id = "<%= ctx[:vars]['id_group'] %>-child@<%= ctx[:test_env_vars]['org_domain'] %>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch out for tabs vs spaces

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 12 files changed, 92 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 25 files changed, 2087 insertions(+), 14 deletions(-))
TF Conversion: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=122650"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud Identity Group resources
4 participants