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

feat: Add Create function for githubipallowlist_ip_allow_list_entry resource #5

Merged
merged 5 commits into from
Jan 2, 2023

Conversation

pzmi-f3
Copy link
Contributor

@pzmi-f3 pzmi-f3 commented Dec 30, 2022

This change adds a githubipallowlist_ip_allow_list_entry resource with a limited implementation. It implements one of the functions managing githubipallowlist_ip_allow_list_entry, Create, on an organization level. The resource still lacks Read, Update and Delete functions, so it's not fully functional. Intention of this change is to provide a chunk of code that's manageable for a reviewer together that can actually be run with a real results (changes to the allow list).

To validate changes run the simple example from examples directory:

  1. Follow Building The Provider section from README
  2. Generate a Personal Access Token (classic) with an admin:org scope.
  3. Run the following script filling missing variables:
cd $PROJECT_ROOT/examples/simple
export GITHUB_TOKEN=$GENERATED_TOKEN
export GITHUB_ORGANIZATION=$YOUR_ORGANIZATION_NAME
terraform plan
terraform apply
  1. Manually delete IP 1.2.3.4/32 allow list entry from your organization.

Example output of terraform apply:

image

…esource

This change adds a `githubipallowlist_ip_allow_list_entry` resource with a limited implementation. It implements one of the functions managing `githubipallowlist_ip_allow_list_entry`, Create, on an organization level. The resource still lacks Read, Update and Delete functions, so it's not fully functional. Intention of this change is to provide a chunk of code that's manageable for a reviewer together that can actually be run with a real results (changes to the allow list).

To validate changes run the `simple` example from `examples` directory:

1. Follow [Building The Provider section from README](https://github.com/form3tech-oss/terraform-provider-githubipallowlist/blob/5f6a0e2f6bafc5c041256b8fd4512eb8a0b7e936/README.md#building-the-provider)
2. Generate a Personal Access Token (classic) with an `admin:org` scope.
3. Run the following script filling missing variables:

  ```shell
  cd $PROJECT_ROOT/examples/simple
  export GITHUB_TOKEN=$GENERATED_TOKEN
  export GITHUB_ORGANIZATION=$YOUR_ORGANIZATION_NAME
  terraform plan
  terraform apply
  ```

4. Manually delete IP `1.2.3.4/32` allow list entry from your organization.
@pzmi-f3 pzmi-f3 marked this pull request as ready for review December 30, 2022 15:07
@pzmi-f3 pzmi-f3 requested a review from a team as a code owner December 30, 2022 15:07
Copy link
Contributor

@bart-lisiecki-form3 bart-lisiecki-form3 left a comment

Choose a reason for hiding this comment

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

Looks good overall!

There was a lot of additions, so I hope I didn't miss anything. I appreciate that you reduced the amount of changes to minimum, it's not always easy to introduce chunks that are small but still meaningful!

github/client.go Outdated Show resolved Hide resolved
github/client.go Outdated Show resolved Hide resolved
@pzmi-f3 pzmi-f3 merged commit 06f2b1c into master Jan 2, 2023
@pzmi-f3 pzmi-f3 deleted the pzmi-org-entry-create branch January 2, 2023 14:48
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.

None yet

2 participants