Title | Description |
---|---|
Kustomization Resource |
Creating the Kustomization resource. |
The tanzu-mission-control_kustomization
resource allows you to add, update, and delete Kustomization to a particular scope through Tanzu Mission Control.
To create a kustomization, you must be associated with the cluster.admin or clustergroup.admin role
In Creation of kustomization we must required to create Git Repository first, which we need to referenced in spec of kustomization, Git Repository can be created by using "tanzu-mission-control_git_repository" resource from terraform provider itself.
In the Tanzu Mission Control resource hierarchy, there are two levels at which you can specify Kustomization resources:
- object groups -
cluster_group
block underscope
sub-resource - Kubernetes objects -
cluster
block underscope
sub-resource
Note: The scope parameter is mandatory in the schema and the user needs to add one of the defined scopes to the script for the provider to function. Only one scope per resource is allowed.
# Create Tanzu Mission Control kustomization with attached set as default value.
resource "tanzu-mission-control_kustomization" "create_cluster_group_kustomization" {
name = "tf-kustomization-name" # Required
namespace_name = "tf-namespace" #Required
scope {
cluster_group {
name = "default" # Required
}
}
meta {
description = "Create namespace through terraform"
labels = { "key" : "value" }
}
spec {
path = "testPath" # Required
prune = "testPrune"
interval = "10m" # Default: 5m
target_namespace = "testTargetNamespace"
source {
name = "testGitRepositoryName" # Required
namespace = "testGitRepositoryNamespace" # Required
}
}
}
# Create Tanzu Mission Control kustomization with attached set as default value.
resource "tanzu-mission-control_kustomization" "create_cluster_kustomization" {
name = "tf-kustomization-name" # Required
namespace_name = "tf-namespace" #Required
scope {
cluster {
name = "testcluster" # Required
provisioner_name = "attached" # Default: attached
management_cluster_name = "attached" # Default: attached
}
}
meta {
description = "Create namespace through terraform"
labels = { "key" : "value" }
}
spec {
path = "testPath" # Required
prune = "testPrune"
interval = "10m" # Default: 5m
target_namespace = "testTargetNamespace"
source {
name = "testGitRepositoryName" # Required
namespace = "testGitRepositoryNamespace" # Required
}
}
}
name
(String) Name of the Kustomization.namespace_name
(String) Name of Namespace.scope
(Block List, Min: 1, Max: 1) Scope for the kustomization, having one of the valid scopes: cluster, cluster_group. (see below for nested schema)spec
(Block List, Min: 1, Max: 1) Spec for the Repository. (see below for nested schema)
meta
(Block List, Max: 1) Metadata for the resource (see below for nested schema)
id
(String) The ID of this resource.status
(Map of String) Status for the Kustomization.
Optional:
cluster
(Block List, Max: 1) The schema for cluster full name (see below for nested schema)cluster_group
(Block List, Max: 1) The schema for cluster group full name (see below for nested schema)
Required:
name
(String) Name of this cluster
Optional:
management_cluster_name
(String) Name of the management clusterprovisioner_name
(String) Provisioner of the cluster
Required:
name
(String) Name of the cluster group
Required:
path
(String) Path within the source from which configurations will be applied. The path must exactly match what is in the repository.source
(Block List, Min: 1, Max: 1) Reference to the source from which the configurations will be applied. Please select an existing repository. (see below for nested schema)
Optional:
interval
(String) Interval defines the interval at which to reconcile kustomization.prune
(Boolean) If true, the workloads will be deleted when the kustomization CR is deleted. When prune is enabled, removing the kustomization will trigger a removal of all kubernetes objects previously applied on all clusters of this cluster group by this kustomization.target_namespace
(String) TargetNamespace sets or overrides the namespaces of resources/kustomization yaml while applying on cluster. Namespace specified here must exist on cluster. It won't be created as a result of specifying here. Enter the name of the namespace you want the kustomization to be synced to. Entering a target namespace removes the need to specify a namespace in your kustomization. If the namespace does not exist in the cluster, syncing the kustomization will fail.
Required:
name
(String) Name of the repository.namespace
(String) Namespace of the repository.
Optional:
annotations
(Map of String) Annotations for the resourcedescription
(String) Description of the resourcelabels
(Map of String) Labels for the resource
Read-Only:
resource_version
(String) Resource version of the resourceuid
(String) UID of the resource