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 organisations data source #2530

Closed
wants to merge 1 commit into from
Closed

Add organisations data source #2530

wants to merge 1 commit into from

Conversation

dblooman
Copy link
Contributor

@dblooman dblooman commented Dec 4, 2017

This adds the ability to get a list of account ID's from the organisations service.

@Ninir Ninir added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 5, 2017
Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hi @DaveBlooman

Thank for the work here and sorry for the long silence: we've been pretty busy with other things.

Left a few things to discuss and 2 things to change. I'll extract the Organisation vendors to their own PR.

Thanks!

ForceNew: true,
},
"accounts": {
Type: schema.TypeList,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure accounts are returned in order? if not, would be better to use a Set here

})
if err != nil {
if orgerr, ok := err.(awserr.Error); ok && orgerr.Code() == "ParentNotFoundException" {
log.Printf("[WARN] Orgnization %s not found, removing from state", d.Id())
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Organization

}

if len(accounts) < 1 {
return fmt.Errorf("Your query returned no results. Please change your account ID and try again")
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about modifying this to Please check instead?

Get AWS Organizations account ID's
---

# aws\_organizations
Copy link
Contributor

Choose a reason for hiding this comment

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

Those antislashes are not needed anymore, it is safe to remove them

Read: dataSourceAwsOrganizationsAccountsRead,

Schema: map[string]*schema.Schema{
"account_id": {
Copy link
Contributor

Choose a reason for hiding this comment

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

As a Terraform User, I would expect this data source to return Organisation information, not only members.

So first I would expect describe organisation attributes and then call the ListAccounts endpoint to get users.
It could even be a separated data source.

Thoughts?

@Ninir Ninir added new-data-source Introduces a new data source. service/organizations Issues and PRs that pertain to the organizations service. labels Jan 17, 2018
@dblooman
Copy link
Contributor Author

Hi @Ninir. I have made some changes, split the data sources into two, this should hopefully be clearer now.

Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hey @DaveBlooman

This is much better, thank you a lot for your work and reactivity.

Would you be able to split this work in 2, so that we merge 1 data source in 1 PR?

This is getting into shape, will test it as soon as you can achieve that.

Thanks again! 🚀 ⭐️

@@ -0,0 +1,91 @@
package aws
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not simply naming the file data_source_aws_organization.go? (and other ones below)
Isn't this the main object representing an Organization?

@Ninir Ninir added the waiting-response Maintainers are waiting on response from community or contributor. label Jan 30, 2018
@bflad
Copy link
Contributor

bflad commented Feb 20, 2018

@DaveBlooman will you have time to address PR feedback? No worries if not, we can finish this up for you. 👍

@dblooman
Copy link
Contributor Author

@bflad Probably wont have time this week, so go ahead :)

@bflad bflad added this to the v1.13.0 milestone Mar 9, 2018
@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 28, 2018
@bflad bflad modified the milestones: v1.13.0, v1.14.0 Mar 29, 2018
@bflad bflad modified the milestones: v1.14.0, v1.15.0 Apr 6, 2018
@bflad bflad removed this from the v1.15.0 milestone Apr 18, 2018
@brandonstevens
Copy link
Contributor

@dblooman I realize it's been awhile, but are you able to pick this back up. Since you last left off, a few new PRs duplicate and build on your work. If you're not able to, I'm happy to take it across the finish line for you.

If I understand the feedback correctly (@Ninir correct me if I'm wrong), but the data sources (and file names) just need to be updated. For consistency, it seems like they should be updated to aws_organizations_organization and aws_organizations_account_ids. Once merged in, the other PRs can be reworked to build on it.

@brandonstevens
Copy link
Contributor

@dblooman , @Ninir do you guys mind if I take over this PR and make the required updates myself?

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. service/organizations Issues and PRs that pertain to the organizations service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants