Skip to content

Commit

Permalink
Merge pull request #14 from j3-signalroom/github_issue-13
Browse files Browse the repository at this point in the history
Resolved #13.
  • Loading branch information
j3-signalroom authored Aug 31, 2024
2 parents aa0a16b + 93ff54b commit 586c226
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IaC Confluent API Key Rotation Terraform module
This Terraform [module](https://developer.hashicorp.com/terraform/language/modules) is designed to manage the creation and rotation of Confluent Cloud Resource [API Keys](https://docs.confluent.io/cloud/current/access-management/authenticate/api-keys/api-keys.html). The key rotation is triggered based on the number of days since the key's creation, ensuring that keys are regularly updated for enhanced security. You can also configure the module to retain a specific number of API Keys per [Service Account](https://docs.confluent.io/cloud/current/access-management/identity/service-accounts/overview.html), giving you flexibility in how keys are managed.
This Terraform [module](https://developer.hashicorp.com/terraform/language/modules) is designed to manage the creation and rotation of Confluent [API Keys](https://docs.confluent.io/cloud/current/access-management/authenticate/api-keys/api-keys.html). The key rotation is triggered based on the number of days since the key's creation, ensuring that keys are regularly updated for enhanced security. You can also configure the module to retain a specific number of API Keys per [Service Account](https://docs.confluent.io/cloud/current/access-management/identity/service-accounts/overview.html), giving you flexibility in how keys are managed.

A Terraform module is essentially a collection of [input](https://developer.hashicorp.com/terraform/language/values/variables) and [output](https://developer.hashicorp.com/terraform/language/values/outputs) variables, resources, and configuration files that encapsulate specific functionality. By defining input variables, you can customize the module's behavior without altering its source code, making it adaptable to various use cases. Output variables provide information that can be used by other modules or configurations. This modular approach not only promotes reusability and composability but also simplifies the sharing of standardized configurations across different Terraform setups, enabling more efficient and consistent infrastructure management.

Expand All @@ -20,7 +20,7 @@ A Terraform module is essentially a collection of [input](https://developer.hash

1. Take care of the cloud environment prequisities listed below:
> You need to have the following cloud accounts:
> - [Confluent Cloud Account](https://confluent.cloud/)
> - [Confluent Account](https://confluent.cloud/)
> - [GitHub Account](https://github.com) *with OIDC configured for AWS*
> - [Terraform Cloud Account](https://app.terraform.io/)
Expand Down Expand Up @@ -50,8 +50,8 @@ A Terraform module is essentially a collection of [input](https://developer.hash
d. **Pass Input Variables:** Within the same module block, pass the required input variables by defining them as key-value pairs:
Input Variable|Variable Required|Description
-|-|-
`confluent_cloud_api_key`|Yes|Specifies the Confluent Cloud API Key (also referred as Cloud API ID)
`confluent_cloud_api_secret`|Yes|Specifies the Confluent Cloud API Secret
`confluent_api_key`|Yes|Specifies the Confluent API Key (also referred as Cloud API ID)
`confluent_api_secret`|Yes|Specifies the Confluent API Secret
`day_count`|No|[_Defaults to 30 days_] Specifies how many day(s) should the API Key be rotated for
`number_of_api_keys_to_retain`|No|[_Defaults to 2 API Keys_] Specifies the number of API Keys to retain
`key_display_name`|No|[_Defaults to a display name with current date_] Specifies the name of the human-readable name for the API Key
Expand Down
4 changes: 2 additions & 2 deletions confluent-resources.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Create the Confluent Cloud Resouce API Key Pair based on the service account from the Confluent Cloud Resource
# Create the Confluent Resouce API Key Pair based on the service account from the Confluent Resource
# (e.g., Kafka Cluster or Schema Registry)
resource "confluent_api_key" "resouce_api_key" {
count = var.number_of_api_keys_to_retain
display_name = replace(var.key_display_name, "{date}", time_static.api_key_rotations[count.index].rfc3339)
description = "Creation of the Confluent Cloud Resource API Key managed by Terraform Cloud using Confluent Cloud Resource API Key Rotation Module"
description = "Creation of the Confluent Resource API Key managed by Terraform Cloud using Confluent API Key Rotation Module"

owner {
id = var.owner.id
Expand Down
4 changes: 2 additions & 2 deletions providers.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
provider "confluent" {
cloud_api_key = var.confluent_cloud_api_key
cloud_api_secret = var.confluent_cloud_api_secret
cloud_api_key = var.confluent_api_key
cloud_api_secret = var.confluent_api_secret
}
10 changes: 5 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
variable "confluent_cloud_api_key" {
description = "Confluent Cloud API Key (also referred as Cloud API ID)."
variable "confluent_api_key" {
description = "Confluent API Key (also referred as Cloud API ID)."
type = string
}

variable "confluent_cloud_api_secret" {
description = "Confluent Cloud API Secret."
variable "confluent_api_secret" {
description = "Confluent API Secret."
type = string
sensitive = true
}
Expand Down Expand Up @@ -34,7 +34,7 @@ variable "number_of_api_keys_to_retain" {
variable "key_display_name" {
description = "A descriptive name for the API key."
type = string
default = "Confluent Cloud Service Account API Key - {date} - Managed by Terraform Confluent"
default = "Confluent Service Account API Key - {date} - Managed by Terraform Confluent"
}

variable "owner" {
Expand Down

0 comments on commit 586c226

Please sign in to comment.