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

PLT-1057 - Setup module #1

Merged
merged 1 commit into from
Dec 17, 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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Flaconi/devops
* @Flaconi/devops @Flaconi/platform @Flaconi/ci
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
env:
TARGET: ${{ matrix.target }}
RETRIES: 20
RETRIES: 1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
}
retry make test
env:
RETRIES: 20
RETRIES: 1
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# 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)
-->
# terraform-algolia-api-keys

That module allows to create algolia api keys

[![lint](https://github.com/flaconi/terraform-algolia-api-keys/workflows/lint/badge.svg)](https://github.com/flaconi/terraform-algolia-api-keys/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/terraform-algolia-api-keys/workflows/test/badge.svg)](https://github.com/flaconi/terraform-algolia-api-keys/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/terraform-algolia-api-keys.svg)](https://github.com/flaconi/terraform-algolia-api-keys/releases)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

For requirements regarding module structure: [style-guide-terraform.md](https://github.com/Flaconi/devops-docs/blob/master/doc/conventions/style-guide-terraform.md)
Expand All @@ -18,7 +17,9 @@ For requirements regarding module structure: [style-guide-terraform.md](https://
<!-- TFDOCS_PROVIDER_START -->
## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_algolia"></a> [algolia](#provider\_algolia) | 0.6.0 |

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -27,7 +28,8 @@ No providers.

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5 |
| <a name="requirement_algolia"></a> [algolia](#requirement\_algolia) | 0.6.0 |

<!-- TFDOCS_REQUIREMENTS_END -->

Expand All @@ -38,19 +40,36 @@ No required inputs.

## Optional Inputs

No optional inputs.
The following input variables are optional (have default values):

### <a name="input_api_keys"></a> [api\_keys](#input\_api\_keys)

Description: Map of API Keys

Type:

```hcl
map(object({
description = string,
acl = set(string)
}))
```

Default: `{}`

<!-- TFDOCS_INPUTS_END -->

<!-- TFDOCS_OUTPUTS_START -->
## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_api_keys"></a> [api\_keys](#output\_api\_keys) | Created API Keys through terraform |

<!-- TFDOCS_OUTPUTS_END -->

## License

**[MIT License](LICENSE)**

Copyright (c) 2023 **[Flaconi GmbH](https://github.com/flaconi)**
Copyright (c) 2024 **[Flaconi GmbH](https://github.com/flaconi)**
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "algolia_api_key" "this" {
for_each = var.api_keys
acl = each.value.acl
description = each.value.description
}
5 changes: 5 additions & 0 deletions output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output "api_keys" {
description = "Created API Keys through terraform"
value = algolia_api_key.this
sensitive = true
}
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
variable "api_keys" {
type = map(object({
description = string,
acl = set(string)
}))
default = {}
description = "Map of API Keys"
validation {
condition = alltrue(flatten([for key in var.api_keys : [for p in key.acl : contains(["search", "browse", "addObject", "deleteObject", "listIndexes", "deleteIndex", "settings", "analytics", "recommendation", "usage", "nluReadAnswers", "logs", "seeUnretrievableAttributes"], p)]]))
error_message = "Only the following permissions are allowed: search, browse, addObject, deleteObject, listIndexes, deleteIndex, settings, analytics, recommendation, usage, nluReadAnswers, logs, seeUnretrievableAttributes"
}
}
8 changes: 7 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terraform {
required_version = "~> 1.3"
required_providers {
algolia = {
source = "k-yomo/algolia"
version = "0.6.0"
}
}
required_version = ">= 1.5"
}
Loading