Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terraform-ibm-modules/terraform-ibm-namespace
Configures a Kubernetes namespace or Openshift project.
https://github.com/terraform-ibm-modules/terraform-ibm-namespace
core-team graduated ibm-cloud kubernetes namespace openshift project supported terraform terraform-module
Last synced: 26 days ago
JSON representation
Configures a Kubernetes namespace or Openshift project.
- Host: GitHub
- URL: https://github.com/terraform-ibm-modules/terraform-ibm-namespace
- Owner: terraform-ibm-modules
- License: apache-2.0
- Created: 2024-02-02T10:56:06.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-10-22T08:51:13.000Z (2 months ago)
- Last Synced: 2024-10-23T13:02:32.200Z (2 months ago)
- Topics: core-team, graduated, ibm-cloud, kubernetes, namespace, openshift, project, supported, terraform, terraform-module
- Language: HCL
- Homepage:
- Size: 226 KB
- Stars: 1
- Watchers: 17
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Namespace module
[![Graduated (Supported)](https://img.shields.io/badge/Status-Graduated%20(Supported)-brightgreen)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-namespace?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-namespace/releases/latest)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)This module supports creating multiple Kubernetes namespaces / OpenShift projects with optional annotations and labels.
## Overview
* [terraform-ibm-namespace](#terraform-ibm-namespace)
* [Examples](./examples)
* [Basic example](./examples/basic)
* [Create Namespace on the existing cluster example](./examples/create-namespaces-existing-cluster)
* [Contributing](#contributing)## terraform-ibm-namespace
### Usage
```hcl
##############################################################################
# Init cluster config for kubernetes providers
##############################################################################data "ibm_container_cluster_config" "cluster_config" {
cluster_name_id = var.cluster_id
}##############################################################################
# Config providers
##############################################################################provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key # pragma: allowlist secret
}provider "kubernetes" {
host = data.ibm_container_cluster_config.cluster_config.host
token = data.ibm_container_cluster_config.cluster_config.token
cluster_ca_certificate = data.ibm_container_cluster_config.cluster_config.ca_certificate
}##############################################################################
# Namespace module
##############################################################################module "namespace" {
source = "terraform-ibm-modules/namespace/ibm"
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific
namespaces = [
{
name = "my-namespace"
metadata = {
labels = {
"istio-injection" = "enabled"
}
annotations = {
"name" = "example-annotation"
}
}
},
{
name = "my-namespace-2"
metadata = {
labels = {
"istio-injection" = "enabled"
}
annotations = {
"name" = "example-annotation"
}
}
}
]
}
```### Required IAM access policies
You need the following permissions to run this module.
- IAM Services
- **Kubernetes** service
- `Viewer` platform access
- `Manager` service access### Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.0 |
| [kubernetes](#requirement\_kubernetes) | >= 2.16.1, < 3.0.0 |### Modules
No modules.
### Resources
| Name | Type |
|------|------|
| [kubernetes_namespace.create_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |### Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [namespaces](#input\_namespaces) | Set of namespaces to create |list(object({| n/a | yes |
name = string
metadata = optional(object({
labels = map(string)
annotations = map(string)
}))
}))### Outputs
No outputs.
## Contributing
You can report issues and request features for this module in GitHub issues in the module repo. See [Report an issue or request a feature](https://github.com/terraform-ibm-modules/.github/blob/main/.github/SUPPORT.md).
To set up your local development environment, see [Local development setup](https://terraform-ibm-modules.github.io/documentation/#/local-dev-setup) in the project documentation.