Skip to content

Comments

feat: Adding github_enterprise_ip_allow_list_entry resource#2649

Open
ErikElkins wants to merge 31 commits intointegrations:mainfrom
ErikElkins:feat/enterprise-ip-allow-list
Open

feat: Adding github_enterprise_ip_allow_list_entry resource#2649
ErikElkins wants to merge 31 commits intointegrations:mainfrom
ErikElkins:feat/enterprise-ip-allow-list

Conversation

@ErikElkins
Copy link
Contributor

@ErikElkins ErikElkins commented May 2, 2025

Resolves #2648


Before the change?

  • None

After the change?

  • Adding the github_enterprise_ip_allow_list_entry resource.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-project-automation github-project-automation bot moved this to 🆕 Triage in 🧰 Octokit Active May 2, 2025
@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Jun 3, 2025
@ErikElkins ErikElkins changed the title Adding github_enterprise_ip_allow_list_entry resource feat: Adding github_enterprise_ip_allow_list_entry resource Oct 25, 2025
@github-actions github-actions bot added the Type: Feature New feature or request label Jan 13, 2026
nickfloyd
nickfloyd previously approved these changes Jan 13, 2026
@nickfloyd nickfloyd added this to the v6.10.0 Release milestone Jan 13, 2026
@nickfloyd
Copy link
Member

@ErikElkins Apologies for the delay on getting to this PR. Would you be willing to fix the lint issue? Thank you!

Copy link
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

Is there a REST API for this functionality?

@github-project-automation github-project-automation bot moved this from 👀 In review to 🏗 In progress in 🧰 Octokit Active Jan 13, 2026
@ErikElkins
Copy link
Contributor Author

Yep! Let me jump in here.

Co-authored-by: Steve Hipwell <steve.hipwell@gmail.com>
Co-authored-by: Steve Hipwell <steve.hipwell@gmail.com>
@ErikElkins
Copy link
Contributor Author

ErikElkins commented Jan 13, 2026

Oh, i see the other PR. Should we just close this? EDIT: NEVERMIND

@ErikElkins
Copy link
Contributor Author

Is there a REST API for this functionality?

Doesn't look like they've added it since I opened the PR.

Copy link

@gateixeira gateixeira left a comment

Choose a reason for hiding this comment

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

hi @ErikElkins 👋

I was updating your PR to have the lint fixed and realized that the acceptance tests seem to also not pass. Can you please update the PR with the following? Feel free to validate on your end.

ErikElkins and others added 3 commits January 13, 2026 14:52
Co-authored-by: gateixeira <4645845+gateixeira@users.noreply.github.com>
Co-authored-by: gateixeira <4645845+gateixeira@users.noreply.github.com>
Co-authored-by: gateixeira <4645845+gateixeira@users.noreply.github.com>
Copy link

@gateixeira gateixeira left a comment

Choose a reason for hiding this comment

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

@ErikElkins thanks for the changes!

@ErikElkins
Copy link
Contributor Author

@ErikElkins We'll need you to rebase again 😬

Done!

ErikElkins and others added 3 commits February 20, 2026 08:14
Co-authored-by: Steve Hipwell <steve.hipwell@gmail.com>
Co-authored-by: Steve Hipwell <steve.hipwell@gmail.com>
@deiga deiga requested a review from stevehipwell February 21, 2026 19:10
stevehipwell
stevehipwell previously approved these changes Feb 23, 2026
Copy link
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

LGTM

@stevehipwell
Copy link
Collaborator

@ErikElkins could you please rebase?

stevehipwell
stevehipwell previously approved these changes Feb 24, 2026
Copy link
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

LGTM

@stevehipwell
Copy link
Collaborator

@deiga are you happy with this now? If so could you please approve (or clear your requested changes)?

Comment on lines +233 to +279
var query struct {
Node struct {
IpAllowListEntry struct {
ID githubv4.String
AllowListValue githubv4.String
Name githubv4.String
IsActive githubv4.Boolean
CreatedAt githubv4.String
UpdatedAt githubv4.String
Owner struct {
Enterprise struct {
Slug githubv4.String
} `graphql:"... on Enterprise"`
}
} `graphql:"... on IpAllowListEntry"`
} `graphql:"node(id: $id)"`
}

variables := map[string]any{
"id": githubv4.ID(d.Id()),
}

err := client.Query(ctx, &query, variables)
if err != nil {
return nil, err
}

entry := query.Node.IpAllowListEntry

if err := d.Set("enterprise_slug", string(entry.Owner.Enterprise.Slug)); err != nil {
return nil, err
}
if err := d.Set("ip", string(entry.AllowListValue)); err != nil {
return nil, err
}
if err := d.Set("name", entry.Name); err != nil {
return nil, err
}
if err := d.Set("is_active", entry.IsActive); err != nil {
return nil, err
}
if err := d.Set("created_at", entry.CreatedAt); err != nil {
return nil, err
}
if err := d.Set("updated_at", entry.UpdatedAt); err != nil {
return nil, err
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue: Am I seeing things or did you re-add the API query to the Import func?

The ID should be enough as the Read func is the next thing to be called with futher Terraform operations and it does the exact same thing as Import. It doesn't seem useful to have an API interaction here

Copy link
Collaborator

Choose a reason for hiding this comment

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

I asked for this, the query is required otherwise it'll be recreated du to the IP being unset and the import is a complete waste of time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was the recommended approach by @stevehipwell here: #2649 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@stevehipwell Oh, right.
What if we add the IP to the import ID to circumvent the need for a API call? It's already QUITE difficult to run Import as finding the GQL ID of the allowlist entry requires one to query the API manually first 😬

Actually, I wonder if there is a way to make Import more user friendly? 🤔

Copy link
Contributor Author

@ErikElkins ErikElkins Feb 24, 2026

Choose a reason for hiding this comment

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

I was hoping to do the import based on ip, but IP is not unique in the IP allow list. You could have the same IP and description multiple times in the list for one enterprise. :(

EDIT: It's unique based on IP AND description


err := client.Mutate(ctx, &mutation, input, nil)
if err != nil {
return diag.FromErr(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add error handling that a 404 doesn't unnecessarily create a Terraform error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added error handling and a comment. The GraphQL API (and github go client) means it'll look kinda janky. Let me know if you'd rather have me remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: IP Allow Lists for enterprises and organizations

5 participants