Skip to content

Commit

Permalink
PLT-1057 - Setup module
Browse files Browse the repository at this point in the history
  • Loading branch information
Engerim committed Dec 17, 2024
1 parent 3131e01 commit 7160e33
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 13 deletions.
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
17 changes: 8 additions & 9 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 Down Expand Up @@ -53,4 +52,4 @@ No outputs.

**[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"
}

0 comments on commit 7160e33

Please sign in to comment.