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 cloudflare_account_member resource #78

Merged
merged 6 commits into from
Oct 8, 2018

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Jul 1, 2018

This adds a new resource cloudflare_account_member which is used to
manage account members.

There is a caveat here, which is noted in the README but I'll reiterate,
that once an account member is created, the user object (which is where
the email address is defined) becomes read only and cannot be
updated using the account member endpoints.

This resource does rely on cloudflare/cloudflare-go#196 which in turn
relies on a few PRs in the cloudflare-go library. Would be good to get
those merged and then update the vendored version before merging this to
confirm everything works as expected.

Tests are still outstanding while I get a test account fully setup.

Screenshots (website)

Sidebar navigation

Main page

This adds a new resource `cloudflare_account_member` which is used to manage account members.
)

// This needs to be hooked up to the provider schema instead.
var cloudflareOrgID = os.Getenv("CLOUDFLARE_ORG_ID")
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to work out why d.GetOk("org_id") isn't working in the methods below.

Using org_id also changes a bunch of functionality to be managed since it overrides user_owner_from_zone which isn't used in the account member resource but changing any behaviour to include it may break other things.

https://github.com/terraform-providers/terraform-provider-cloudflare/blob/b9b9853d9b539375104f0a4eb22a1cd41b415fb9/cloudflare/provider.go#L73-L78

Required: true,
},

"role_ids": {
Copy link
Member Author

Choose a reason for hiding this comment

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

Decided to use IDs over Names here as the name could change but the IDs are pretty unique and won't trigger a bunch of extra updates.

@@ -42,7 +42,7 @@ If you wish to work on the provider, you'll first need [Go](http://www.golang.or
To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

```sh
$ make bin
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll throw up a PR soon that will expand on the "how to develop the provider" section since I've had a few people ask me and the documentation is lacking.

@jacobbednarz
Copy link
Member Author

#101 brings in the required functionality for this PR.

@patryk
Copy link
Contributor

patryk commented Jul 30, 2018

Ok, I've broke the PR 🤦🏻‍♂️. Sorry! Need to revert it back.

@patryk
Copy link
Contributor

patryk commented Jul 30, 2018

@jacobbednarz do you want to make any additional changes to this PR or are we good to go?

@jacobbednarz
Copy link
Member Author

We do need to look at https://github.com/terraform-providers/terraform-provider-cloudflare/pull/78/files/2da08fc70772bb4073470055e5ec3886309c10bd#diff-2e16a4318cb61e160f7ac9dc64bca334 otherwise the account number doesn't get applied correctly. I haven't quite found the link for this yet but can have another peek.

This landed in f1d2944 so we can use it instead of the janky OS lookups.
@ghost ghost added the size/L label Sep 6, 2018
@jacobbednarz
Copy link
Member Author

@patryk This should be good to rock and roll now. You've already updated the vendored version of cloudflare-go to support this in the last couple of days. 🚢

@ghost ghost added the size/L label Sep 6, 2018
Copy link
Contributor

@simpsora simpsora left a comment

Choose a reason for hiding this comment

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

👍

Looking forward to this landing!

@patryk
Copy link
Contributor

patryk commented Oct 8, 2018

Awesome stuff, guys! Thanks so much!

@patryk patryk merged commit d5cc209 into cloudflare:master Oct 8, 2018
@jacobbednarz jacobbednarz deleted the add-account-member-resource branch October 8, 2018 20:42
@jacobbednarz
Copy link
Member Author

Thanks @patryk 🌮

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.

3 participants