-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add module Kubernetes namespace (#1)
- Loading branch information
1 parent
2aa48ee
commit 6a3e0c2
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,41 @@ | ||
# Module name | ||
# Kubernetes Namespace | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.4 | | ||
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | ~>2.20 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | ~>2.20 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [kubernetes_namespace_v1.main](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace_v1) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_annotations"></a> [annotations](#input\_annotations) | An unstructured key value map stored with the namespace that may be used to store arbitrary metadata | `map(string)` | `{}` | no | | ||
| <a name="input_labels"></a> [labels](#input\_labels) | Map of string keys and values that can be used to organize and categorize namespaces | `map(string)` | `{}` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | Kubernetes namespace name | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_generation"></a> [generation](#output\_generation) | A sequence number representing a specific generation of the desired state | | ||
| <a name="output_name"></a> [name](#output\_name) | The name of namespace | | ||
| <a name="output_uid"></a> [uid](#output\_uid) | The unique in time and space value for this namespace | | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "kubernetes_namespace_v1" "main" { | ||
metadata { | ||
name = var.name | ||
|
||
annotations = { | ||
name = var.name | ||
} | ||
|
||
labels = var.labels | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
output "uid" { | ||
description = "The unique in time and space value for this namespace" | ||
value = kubernetes_namespace_v1.main.metadata[0].uid | ||
} | ||
|
||
output "name" { | ||
description = "The name of namespace" | ||
value = kubernetes_namespace_v1.main.metadata[0].name | ||
} | ||
|
||
output "generation" { | ||
description = "A sequence number representing a specific generation of the desired state" | ||
value = kubernetes_namespace_v1.main.metadata[0].generation | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
variable "name" { | ||
description = "Kubernetes namespace name" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "labels" { | ||
description = "Map of string keys and values that can be used to organize and categorize namespaces" | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
variable "annotations" { | ||
description = "An unstructured key value map stored with the namespace that may be used to store arbitrary metadata" | ||
type = map(string) | ||
default = {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1.4" | ||
|
||
required_providers { | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = "~>2.20" | ||
} | ||
} | ||
} |