### Generate Documentation Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/CONTRIBUTING.md Generate or update the provider's documentation. This is necessary if any schemas or guides have been modified. ```bash make docs ``` -------------------------------- ### Import Existing Flux Installation Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/resources/bootstrap_git.md Use this command to import an existing Flux installation into your Terraform state. Pass the namespace where Flux is installed as an argument. ```shell terraform import flux_bootstrap_git.this flux-system ``` -------------------------------- ### Bootstrap Git Resource Schema Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/resources/bootstrap_git.md Defines the configurable attributes for the Bootstrap Git resource, allowing users to customize Flux installation and behavior. ```APIDOC ## Bootstrap Git Resource Schema ### Optional Attributes - `cluster_domain` (String) - The internal cluster domain. Defaults to `cluster.local`. - `components` (Set of String) - Toolkit components to include in the install manifests. Defaults to `[source-controller kustomize-controller helm-controller notification-controller]`. - `components_extra` (Set of String) - List of extra components to include in the install manifests. - `delete_git_manifests` (Boolean) - Delete manifests from git repository. Defaults to `true`. - `disable_secret_creation` (Boolean) - Use the existing secret for flux controller and don't create one from bootstrap. - `embedded_manifests` (Boolean) - When enabled, the Flux manifests will be extracted from the provider binary instead of being downloaded from GitHub.com. Defaults to `false`. - `image_pull_secret` (String) - Kubernetes secret name used for pulling the toolkit images from a private registry. - `interval` (String) - Interval at which to reconcile from bootstrap repository. Defaults to `1m0s`. - `keep_namespace` (Boolean) - Keep the namespace after uninstalling Flux components. Defaults to `false`. - `kustomization_override` (String) - Kustomization to override configuration set by default. - `log_level` (String) - Log level for toolkit components. Defaults to `info`. - `manifests_path` (String, Deprecated) - The install manifests are built from a GitHub release or kustomize overlay if using a local path. Defaults to `https://github.com/fluxcd/flux2/releases`. - `namespace` (String) - The namespace scope for install manifests. Defaults to `flux-system`. It will be created if it does not exist. - `network_policy` (Boolean) - Deny ingress access to the toolkit controllers from other namespaces using network policies. Defaults to `true`. - `path` (String) - Path relative to the repository root, when specified the cluster sync will be scoped to this path (immutable). - `recurse_submodules` (Boolean) - Configures the GitRepository source to initialize and include Git submodules in the artifact it produces. - `registry` (String) - Container registry where the toolkit images are published. Defaults to `ghcr.io/fluxcd`. - `registry_credentials` (String) - Container registry credentials in the format 'user:password'. - `secret_name` (String) - Name of the secret the sync credentials can be found in or stored to. Defaults to `flux-system`. - `timeouts` (Attributes) - Nested schema for timeouts. - `toleration_keys` (Set of String) - List of toleration keys used to schedule the components pods onto nodes with matching taints. - `version` (String) - Flux version. Defaults to `v2.8.8`. Has no effect when `embedded_manifests` is enabled. - `watch_all_namespaces` (Boolean) - If true watch for custom resources in all namespaces. Defaults to `true`. ### Read-Only Attributes - `id` (String) - The ID of this resource. - `repository_files` (Map of String) - Git repository files created and managed by the provider. ### Nested Schema for `timeouts` Optional: - `create` (String) - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). - `delete` (String) - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. - `read` (String) - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. - `update` (String) - A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). ``` -------------------------------- ### Configure Flux Provider with Git URL Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure the Flux provider with Kubernetes credentials and a Git repository URL. This is a basic setup for interacting with Git repositories. ```hcl provider "flux" { kubernetes = { config_path = "~/.kube/config" } git = { url = "https://example.com" } } ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/CONTRIBUTING.md Clone the terraform-provider-flux repository and navigate into the project directory to begin development. ```sh git clone https://github.com/fluxcd/terraform-provider-flux.git cd terraform-provider-flux ``` -------------------------------- ### Git Configuration Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure access to Git repositories for bootstrapping Flux. ```APIDOC ## Git Configuration ### Description Configure access to Git repositories for bootstrapping Flux. ### Parameters #### Path Parameters - **url** (String) - Required - Url of Git repository to bootstrap from. #### Optional Parameters - **author_email** (String) - Optional - Author email for Git commits. - **author_name** (String) - Optional - Author name for Git commits. Defaults to `Flux`. - **branch** (String) - Optional - Branch of the repository to reconcile from. Defaults to `main`. - **commit_message_appendix** (String) - Optional - String to add to the commit messages. - **gpg_key_id** (String) - Optional - Key id for selecting a particular GPG key. - **gpg_key_ring** (String) - Optional - Path to the GPG key ring for signing commits. - **gpg_passphrase** (String, Sensitive) - Optional - Passphrase for decrypting GPG private key. ### Nested Schemas #### HTTP Configuration - **allow_insecure_http** (Boolean) - Optional - Allows http Git url connections. - **certificate_authority** (String) - Optional - Certificate authority to validate self-signed certificates. - **password** (String, Sensitive) - Optional - Password for basic authentication. - **username** (String) - Optional - Username for basic authentication. #### SSH Configuration - **hostkey_algos** (List of String) - Optional - The list of hostkey algorithms to use for ssh connections, arranged from most preferred to the least. - **password** (String, Sensitive) - Optional - Password of the SSH private key. - **private_key** (String, Sensitive) - Optional - Private key used for authenticating to the Git SSH server. - **username** (String) - Optional - Username for Git SSH server. ``` -------------------------------- ### Run Acceptance Tests Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/CONTRIBUTING.md Execute the acceptance tests for the provider to ensure functionality and stability. ```bash make testacc ``` -------------------------------- ### Build Provider and Configure Local Terraform Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/CONTRIBUTING.md Build the provider locally and set up a Terraform CLI configuration file to use this local build. This allows testing changes without publishing. ```sh make build make terraformrc export TF_CLI_CONFIG_FILE="${PWD}/.terraformrc" ``` -------------------------------- ### Kubernetes Configuration Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure access to Kubernetes clusters. ```APIDOC ## Kubernetes Configuration ### Description Configure access to Kubernetes clusters. ### Parameters #### Optional Parameters - **client_certificate** (String) - Optional - PEM-encoded client certificate for TLS authentication. - **client_key** (String) - Optional - PEM-encoded client certificate key for TLS authentication. - **cluster_ca_certificate** (String) - Optional - PEM-encoded root certificates bundle for TLS authentication. - **config_context** (String) - Optional - Context to choose from the config file. - **config_context_auth_info** (String) - Optional - Authentication info context of the kube config (name of the kubeconfig user, `--user` flag in `kubectl`). - **config_context_cluster** (String) - Optional - Cluster context of the kube config (name of the kubeconfig cluster, `--cluster` flag in `kubectl`). - **config_path** (String) - Optional - Path to the kube config file. Can be set with KUBE_CONFIG_PATH. - **config_paths** (Set of String) - Optional - A list of paths to kube config files. Can be set with KUBE_CONFIG_PATHS environment variable. - **host** (String) - Optional - The hostname (in form of URI) of Kubernetes master. - **insecure** (Boolean) - Optional - Whether server should be accessed without verifying the TLS certificate. - **password** (String) - Optional - The password to use for HTTP basic authentication when accessing the Kubernetes master endpoint. - **proxy_url** (String) - Optional - URL to the proxy to be used for all API requests. - **token** (String) - Optional - Token to authenticate an service account. - **username** (String) - Optional - The username to use for HTTP basic authentication when accessing the Kubernetes master endpoint. ### Nested Schemas #### Exec Configuration - **api_version** (String) - Required - Kubernetes client authentication API Version. - **command** (String) - Required - Client authentication exec command. - **args** (List of String) - Optional - Client authentication exec command arguments. - **env** (Map of String) - Optional - Client authentication exec environment variables. ``` -------------------------------- ### Configure Flux Provider with Exec Plugin for EKS Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure the Flux provider to use an exec plugin for Kubernetes authentication, suitable for environments like EKS that use short-lived tokens. The plugin fetches a new token using a CLI tool. ```hcl provider "flux" { kubernetes = { host = var.cluster_endpoint cluster_ca_certificate = base64decode(var.cluster_ca_cert) exec = { api_version = "client.authentication.k8s.io/v1beta1" args = ["eks", "get-token", "--cluster-name", var.cluster_name] command = "aws" } } } ``` -------------------------------- ### Configure Flux Provider with Multiple Kubeconfig Paths Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure the Flux provider to use multiple kubeconfig files. The provider will attempt to use configurations from all specified paths. ```hcl provider "flux" { kubernetes = { config_paths = [ "/path/a/kubeconfig", "/path/b/kubeconfig" ] } } ``` -------------------------------- ### Configure Flux Provider with Explicit Credentials Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure the Flux provider with explicit Kubernetes connection details, including host, client certificate, client key, and CA certificate. This method is useful when not relying on a kubeconfig file. ```hcl provider "flux" { kubernetes = { host = "https://cluster-api-hostname:port" client_certificate = file("~/.kube/client-cert.pem") client_key = file("~/.kube/client-key.pem") cluster_ca_certificate = file("~/.kube/cluster-ca-cert.pem") } } ``` -------------------------------- ### Configure Flux Provider with Kubeconfig Path Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/docs/index.md Configure the Flux provider to use a specific kubeconfig file for Kubernetes authentication. The default context in the kubeconfig will be used unless specified otherwise. ```hcl provider "flux" { kubernetes = { config_path = "~/.kube/config" } } ``` -------------------------------- ### Sign Commit Message Source: https://github.com/fluxcd/terraform-provider-flux/blob/main/CONTRIBUTING.md Sign off your commits to certify you have the legal right to contribute the material. This can be done automatically if your Git user.name and user.email are configured. ```git Signed-off-by: Jane Doe ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.