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

Add module code #1

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# terraform-module-template
Template for Terraform modules

<!-- Uncomment and replace with your module name
[![lint](https://github.com/flaconi/<MODULENAME>/workflows/lint/badge.svg)](https://github.com/flaconi/<MODULENAME>/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/<MODULENAME>/workflows/test/badge.svg)](https://github.com/flaconi/<MODULENAME>/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/<MODULENAME>.svg)](https://github.com/flaconi/<MODULENAME>/releases)
-->
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
# terraform-github-app-installation

This module manages GitHub App permissions for multiple repositories

[![lint](https://github.com/flaconi/terraform-github-app-installation/workflows/lint/badge.svg)](https://github.com/flaconi/terraform-github-app-installation/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/terraform-github-app-installation/workflows/test/badge.svg)](https://github.com/flaconi/terraform-github-app-installation/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/terraform-github-app-installation.svg)](https://github.com/flaconi/terraform-github-app-installation/releases)

For requirements regarding module structure: [style-guide-terraform.md](https://github.com/Flaconi/devops-docs/blob/master/doc/conventions/style-guide-terraform.md)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

<!-- TFDOCS_HEADER_START -->

Expand All @@ -18,7 +16,9 @@ For requirements regarding module structure: [style-guide-terraform.md](https://
<!-- TFDOCS_PROVIDER_START -->
## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_github"></a> [github](#provider\_github) | ~> 6.2 |

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -28,13 +28,26 @@ No providers.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_github"></a> [github](#requirement\_github) | ~> 6.2 |

<!-- TFDOCS_REQUIREMENTS_END -->

<!-- TFDOCS_INPUTS_START -->
## Required Inputs

No required inputs.
The following input variables are required:

### <a name="input_installation_id"></a> [installation\_id](#input\_installation\_id)

Description: GitHub App installation id

Type: `string`

### <a name="input_repositories"></a> [repositories](#input\_repositories)

Description: List of names of repositories which will be granted access to.

Type: `list(string)`

## Optional Inputs

Expand All @@ -53,4 +66,4 @@ No outputs.

**[MIT License](LICENSE)**

Copyright (c) 2023 **[Flaconi GmbH](https://github.com/flaconi)**
Copyright (c) 2024 **[Flaconi GmbH](https://github.com/flaconi)**
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "github_app_installation_repositories" "this" {
installation_id = var.installation_id
selected_repositories = var.repositories
}
14 changes: 14 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "installation_id" {
description = "GitHub App installation id"
type = string
sensitive = true
}

variable "repositories" {
description = "List of names of repositories which will be granted access to."
type = list(string)
validation {
condition = length(var.repositories) > 0
error_message = "Application should have permission for at least one repository"
}
}
6 changes: 6 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.2"
}
}
required_version = "~> 1.3"
}