Skip to content

Commit

Permalink
Added RepositoryCollaborator resource (human modified files)
Browse files Browse the repository at this point in the history
Signed-off-by: Asaf Haim <[email protected]>
  • Loading branch information
asafhm committed Oct 18, 2024
1 parent 1c9623d commit eb8c5c3
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ spec:
| `BranchProtection` | `repo` | `github_branch_protection` | |
| `RepositoryFile` | `repo` | `github_repository_file` | |
| `RepositoryAutolinkReference` | `repo` | `github_repository_autolink_reference` | |
| `RepositoryCollaborator` | `repo` | `github_repository_collaborator` | |
| `RepositoryWebhook` | `repo` | `github_repository_webhook` | |
| `PullRequest` | `repo` | `github_repository_pull_request` | |
| `DeployKey` | `repo` | `github_repository_deploy_key` | |
Expand Down
2 changes: 2 additions & 0 deletions config/external_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ var terraformPluginSDKExternalNameConfigs = map[string]config.ExternalName{
"github_organization_ruleset": config.IdentifierFromProvider,
// Can be imported using the following format: {{ repository }}/{{ id }} or {{ key_prefix }}.
"github_repository_autolink_reference": config.IdentifierFromProvider,
// Can be imported using the following format: {{ repository }}:{{ username }}.
"github_repository_collaborator": config.IdentifierFromProvider,
}

// cliReconciledExternalNameConfigs contains all external name configurations
Expand Down
2 changes: 2 additions & 0 deletions config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/crossplane-contrib/provider-upjet-github/config/pullrequest"
"github.com/crossplane-contrib/provider-upjet-github/config/repository"
"github.com/crossplane-contrib/provider-upjet-github/config/repositoryautolinkreference"
"github.com/crossplane-contrib/provider-upjet-github/config/repositorycollaborator"
"github.com/crossplane-contrib/provider-upjet-github/config/repositoryfile"
"github.com/crossplane-contrib/provider-upjet-github/config/repositorywebhook"
"github.com/crossplane-contrib/provider-upjet-github/config/team"
Expand Down Expand Up @@ -79,6 +80,7 @@ func GetProvider(ctx context.Context) (*ujconfig.Provider, error) {
organization.Configure,
organizationruleset.Configure,
repositoryautolinkreference.Configure,
repositorycollaborator.Configure,
membership.Configure,
teamsettings.Configure,
teamsyncgroupmapping.Configure,
Expand Down
17 changes: 17 additions & 0 deletions config/repositorycollaborator/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package repositorycollaborator

import "github.com/crossplane/upjet/pkg/config"

// Configure github_repository_collaborator resource.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("github_repository_collaborator", func(r *config.Resource) {
// We need to override the default group that upjet generated for
// this resource, which would be "github"
r.Kind = "RepositoryCollaborator"
r.ShortGroup = "repo"

r.References["repository"] = config.Reference{
TerraformName: "github_repository",
}
})
}
25 changes: 25 additions & 0 deletions tests/cases/repo-collaborator/repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: repo.github.upbound.io/v1alpha1
kind: Repository
metadata:
name: github-crossplane-collaborator-test
spec:
forProvider:
visibility: public
autoInit: true
gitignoreTemplate: Terraform
providerConfigRef:
name: default
---
apiVersion: repo.github.upbound.io/v1alpha1
kind: RepositoryCollaborator
metadata:
name: repo-collaborator
spec:
forProvider:
repositoryRef:
name: github-crossplane-collaborator-test
username: someuser
permission: admin
providerConfigRef:
name: default

0 comments on commit eb8c5c3

Please sign in to comment.