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

Adds new resource cloudflare_ip_list #766

Merged
merged 9 commits into from
Aug 23, 2020
Merged

Conversation

cehrig
Copy link

@cehrig cehrig commented Aug 16, 2020

This PR adds a new resource for managing account-level IP Lists (https://blog.cloudflare.com/introducing-ip-lists/)

WIP:
- Write acceptance tests
- Update cloudflare-go @jacobbednarz, i might need a hand here
- Documentation

Sample resource block

resource "cloudflare_ip_list" "example" {
  account_id = "d41d8cd98f00b204e9800998ecf8427e"
  name = "example_list"
  kind = "ip"
  description = "list description"

  item {
    value = "192.0.2.0"
    comment = "one"
  }

  item {
    value = "192.0.2.1"
    comment = "two"
  }
}

@jacobbednarz
Copy link
Member

Does IP Lists have public API support yet? If not, I'd probably wait for that to see what the schema needs to support.

@cehrig
Copy link
Author

cehrig commented Aug 16, 2020

Does IP Lists have public API support yet? If not, I'd probably wait for that to see what the schema needs to support.

@jacobbednarz That's IP Lists aka Rules Lists we put to cloudflare-go some weeks ago: cloudflare/cloudflare-go#507

@jacobbednarz
Copy link
Member

Ahhh, I remember that PR but didn't associate it with the issue I raised and thought was still open. Good to see!

@jacobbednarz
Copy link
Member

As for the updated dependency, once a new release is created an automatic PR will be opened here. If it's about time for a new release, we can ping @patryk to take a look.

@cehrig
Copy link
Author

cehrig commented Aug 16, 2020

Sounds good. I honestly was expecting the checks to fail because vendor/ is not yet updated. So either I don't fully understand Go modules or the checks are not building the final binary and they are passing because Unit Tests are not yet written.

}

func resourceCloudflareIPListImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
listID := d.Id()
Copy link
Member

Choose a reason for hiding this comment

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

I suspect we will need the ID to be a composite ID of accountID/listID to allow people with access to multiple accounts to determine which one they would like to manage.

Copy link
Author

Choose a reason for hiding this comment

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

Oh thanks for raising this. I was a victim to DefaultFunc: schema.EnvDefaultFunc("CLOUDFLARE_ACCOUNT_ID", nil), in provider.go ... I'll get the whole PR ready by - hopefully - tomorrow!

Copy link
Member

Choose a reason for hiding this comment

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

No rush! I just finally had some time this morning to review some PRs and yours was at the top of the list 🙂

Copy link
Author

Choose a reason for hiding this comment

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

This is fixed

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

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

Looks pretty reasonable so far 👍 A question around multiple account usage but we'll also need some tests when you're ready.

@cehrig
Copy link
Author

cehrig commented Aug 20, 2020

Okay, I think this is in a decent shape. Reviews appreciated :-)

@cehrig cehrig marked this pull request as ready for review August 20, 2020 19:01
@cehrig cehrig changed the title Adds new resource cloudflare_ip_list (WIP) Adds new resource cloudflare_ip_list Aug 20, 2020
@jacobbednarz
Copy link
Member

I've pushed 5794234 as the test account has a limit of 1 list at a time and the parallel tests step on top of one another.

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

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

🙇‍♂️ thanks heaps for this @cehrig!

@jacobbednarz jacobbednarz merged commit 8924608 into cloudflare:master Aug 23, 2020
boekkooi-lengoo pushed a commit to boekkooi-lengoo/terraform-provider-cloudflare that referenced this pull request Feb 28, 2022
add 'omitempty' to APIToken 'name' and 'policies' fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants