Skip to content

Commit

Permalink
Update provider to 6.0.0 (#15)
Browse files Browse the repository at this point in the history
* feat(flake): update github provider

* chore(flake): update provider to 6.0.0

* fix(terraformignore)

* fix(justfile)

* docs(README)
  • Loading branch information
erikreinert authored Feb 28, 2024
1 parent 96e2b6f commit c92fd73
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 61 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/flake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,30 @@ on:
- main

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: DeterminateSystems/nix-installer-action@main
- uses: cachix/cachix-action@v12
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
name: altf4llc-os
- uses: actions/checkout@v3
- run: cachix use altf4llc-os
- run: nix develop -c just check
- run: nix develop -c just cache-inputs
- run: nix develop -c just cache-shell

build:
needs:
- check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix flake check
- run: nix develop -c just check
- uses: DeterminateSystems/nix-installer-action@main
- uses: cachix/cachix-action@v12
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
name: altf4llc-os
- uses: actions/checkout@v4
- run: cachix use altf4llc-os
- run: nix develop -c just cache-build
2 changes: 1 addition & 1 deletion .terraformignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.gitignore
flake.lock
flake.nix
makefile
justfile
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Terraform module which creates GitHub repository resources.

| Name | Version |
|------|---------|
| <a name="requirement_github"></a> [github](#requirement\_github) | 5.41.0 |
| <a name="requirement_github"></a> [github](#requirement\_github) | 6.0.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_github"></a> [github](#provider\_github) | 5.41.0 |
| <a name="provider_github"></a> [github](#provider\_github) | 6.0.0 |

## Modules

Expand All @@ -22,10 +22,10 @@ No modules.

| Name | Type |
|------|------|
| [github_branch_protection.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/resources/branch_protection) | resource |
| [github_repository.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/resources/repository) | resource |
| [github_team_repository.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/resources/team_repository) | resource |
| [github_team.self](https://registry.terraform.io/providers/integrations/github/5.41.0/docs/data-sources/team) | data source |
| [github_branch_protection.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/resources/branch_protection) | resource |
| [github_repository.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/resources/repository) | resource |
| [github_team_repository.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/resources/team_repository) | resource |
| [github_team.self](https://registry.terraform.io/providers/integrations/github/6.0.0/docs/data-sources/team) | data source |

## Inputs

Expand All @@ -44,7 +44,7 @@ No modules.
| <a name="input_has_wiki"></a> [has\_wiki](#input\_has\_wiki) | Whether the repository has wiki enabled | `bool` | `false` | no |
| <a name="input_license_template"></a> [license\_template](#input\_license\_template) | Wheter the repository uses a license template | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the repository | `string` | n/a | yes |
| <a name="input_owner"></a> [owner](#input\_owner) | The name of the repository | `string` | n/a | yes |
| <a name="input_owner"></a> [owner](#input\_owner) | The owner of the repository | `string` | n/a | yes |
| <a name="input_required_status_checks_contexts"></a> [required\_status\_checks\_contexts](#input\_required\_status\_checks\_contexts) | The list of status checks to require in order to merge into this branch | `list(string)` | `[]` | no |
| <a name="input_teams"></a> [teams](#input\_teams) | The teams to grant access to, and their permission levels | `map(string)` | `{}` | no |
| <a name="input_topics"></a> [topics](#input\_topics) | The topics of the repository | `list(string)` | `[]` | no |
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 45 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,61 @@

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = inputs@{ flake-parts, nixpkgs, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }:
let
inherit (pkgs) just terraform terraform-docs;
terraform-github = pkgs.terraform-providers.mkProvider {
outputs = inputs @ {
flake-parts,
nixpkgs,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: let
inherit (pkgs) just terraform-docs;
terraform = pkgs.terraform.withPlugins (p: [
(pkgs.terraform-providers.mkProvider {
hash = "sha256-y8DMpNSySMbe7E+sGVQcQdEyulq4Wnp5ryYD7FQO/fc=";
homepage = "https://registry.terraform.io/providers/integrations/github";
owner = "integrations";
repo = "terraform-provider-github";
rev = "v5.41.0";
hash = "sha256-fWxWcHy3TWFEpkU9uDSsHbUu+dnQKfvquN63eZH+Qf0=";
rev = "v6.0.0";
vendorHash = null;
};
in
{
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
})
]);
in {
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};

packages = {
terraform-with-plugins = pkgs.terraform.withPlugins (ps: [
terraform-github
]);
devShells = {
default = pkgs.mkShell {
buildInputs = [
just
terraform
terraform-docs
];
};
};

default = pkgs.runCommand "default"
{
src = ./.;
} ''
packages = {
default =
pkgs.runCommand "default"
{
src = ./.;
} ''
mkdir -p $out
cp -R $src/*.tf $out
${config.packages.terraform-with-plugins}/bin/terraform -chdir="$out" init
${config.packages.terraform-with-plugins}/bin/terraform -chdir="$out" validate
${terraform}/bin/terraform -chdir="$out" init
${terraform}/bin/terraform -chdir="$out" validate
'';
};

devShells = {
default = pkgs.mkShell {
buildInputs = [
just
terraform
terraform-docs
];
};
};
};
};
};
}
28 changes: 27 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
_default:
just --list

build:
nix build --json --no-link --print-build-logs

cache-build cache_name="altf4llc-os":
just build \
| jq -r '.[].outputs | to_entries[].value' \
| cachix push {{ cache_name }}

cache-inputs cache_name="altf4llc-os":
nix flake archive --json \
| jq -r '.path,(.inputs|to_entries[].value.path)' \
| cachix push "{{ cache_name }}"

cache-shell cache_name="altf4llc-os":
nix develop --profile "dev-profile" -c true
cachix push "{{ cache_name }}" "dev-profile"

check:
nix build --json --no-link --print-build-logs
nix flake check

docs:
terraform-docs markdown table \
--output-file README.md \
--output-mode inject .

init:
terraform init

validate:
terraform validate
2 changes: 1 addition & 1 deletion providers.tf → versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
github = {
source = "integrations/github"
version = "5.41.0"
version = "6.0.0"
}
}
}

0 comments on commit c92fd73

Please sign in to comment.