diff --git a/README.md b/README.md index 68c383b..f3684fb 100644 --- a/README.md +++ b/README.md @@ -46,12 +46,20 @@ minikube start --driver=docker --download-only ### Initialization -Initializes a new environment named . Creates a directory structure and a default configuration file. +Initializes a new environment named . Creates a directory structure, a default configuration file, and a "sample-app" service to get you started quickly. ```bash sailr init ``` +### Add Service + +Adds a new service to your project. This creates boilerplate Kubernetes templates (`deployment.yaml`, `service.yaml`, `configmap.yaml`) in `k8s/templates//` and adds the service to the `develop` environment's configuration. + +```bash +sailr add service --type +``` + ### Completions Generates shell completion scripts for bash or zsh to enhance the Sailr CLI experience. @@ -89,16 +97,18 @@ sailr build [--ignore ] Combines generation and deployment in a single command for the environment. ```bash -sailr go : +sailr go ``` ### Additional Notes - Use the --force flag with build to rebuild all service images regardless of the cache. +- For a full list of commands and their detailed options, please see the [CLI Command Reference](docs/docs/cli-usage.md). ### Getting Help -- Consult the Sailr project documentation [here](docs/docs/intro.md). +- Consult the main Sailr project documentation [here](docs/docs/intro.md). +- For detailed CLI command information, refer to the [CLI Command Reference](docs/docs/cli-usage.md). ## Sailr Configuration File diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..cd59691 --- /dev/null +++ b/config.toml @@ -0,0 +1,44 @@ +schema_version = "0.2.0" +name = "dev" +log_level = "INFO" +domain = "example.com" +default_replicas = 1 +registry = "docker.io" + +[[service_whitelist]] +version = "latest" +path = "" +name = "default/test" + +[[service_whitelist]] +path = "core/test2" +build = "./test" +name = "test-namespace/test2" +version = "1.2.0" + +[[service_whitelist]] +name = "default/test-portal2" +path = "test-portal2" +version = "latest" + +[build] +beforeAll = "echo 'do something before'" + +[build.rooms.test] +path = "./test" +include = "./**/*.*" +after = "docker push test:latest" + +[build.rooms.test2] +path = "./test2" +include = "./**/*.*" +before = "docker build -t docker.io/test2:latest ." +after = "docker push docker.io/test2:latest" + +[[environment_variables]] +name = "REDIS_HOST" +value = "redis" + +[[environment_variables]] +name = "REDIS_PORT" +value = "6379" diff --git a/docs/docs/cli-usage.md b/docs/docs/cli-usage.md index e86481f..d007f14 100644 --- a/docs/docs/cli-usage.md +++ b/docs/docs/cli-usage.md @@ -39,6 +39,30 @@ Initializes a new Sailr environment, creating its directory structure (e.g., `./ # Initialize with a custom registry and AWS provider settings sailr init --name staging --registry quay.io/my-company --provider Aws --region us-east-1 ``` +* **Note on Default Service:** The `sailr init` command also creates a default "sample-app" service. This includes generating basic Kubernetes manifest templates (Deployment, Service, ConfigMap) in `k8s/templates/sample-app/` and adding a corresponding service entry to the new environment's `config.toml`. This makes the newly initialized environment immediately runnable and provides a quick way to demonstrate Sailr's capabilities. + +--- + +### `sailr add service` + +Adds a new service to your Sailr project. This involves generating boilerplate Kubernetes manifest templates and updating the environment configuration. + +* **Usage:** `sailr add service --type ` +* **Arguments & Options:** + * ``: (Required) The name for the new service (e.g., `my-api`, `frontend-app`). This name will be used for the template directory and in the service configuration. + * `-t, --type `: (Required) Specifies the type of application (e.g., `web-app`, `worker`, `database`). This can influence the structure and content of the generated templates. +* **Actions Performed:** + * Creates a new directory `k8s/templates//`. + * Generates the following Kubernetes manifest template files within this directory: + * `deployment.yaml` + * `service.yaml` + * `configmap.yaml` + * Adds a new service entry to the `k8s/environments/develop/config.toml` file (assuming "develop" is the current or default environment for this operation). This entry allows Sailr to manage and deploy the new service. +* **Example:** + ```bash + # Add a new web application service named "user-api" + sailr add service user-api --type web-app + ``` --- diff --git a/src/cli.rs b/src/cli.rs index 8b0037f..f21120e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -30,6 +30,8 @@ pub enum Commands { Go(GoArgs), /// Kubernetes resources commands K8s(K8sArgs), + /// Add a new service to the project + AddService(AddServiceArgs), } #[derive(Debug, Args)] @@ -373,3 +375,33 @@ pub struct GetArgs { )] pub context: String, } + +#[derive(Debug, Args)] +pub struct AddServiceArgs { + #[arg(help = "Name of the service")] + pub service_name: String, + + #[arg( + short = 't', + long = "type", + help = "Type of the application (e.g., web-app, worker)" + )] + pub app_type: String, + + #[arg( + short = 'p', + long = "port", + help = "Port for the service (default is 80)" + )] + pub port: Option, + + #[arg( + short = 'i', + long = "image", + help = "Docker image for the service (default is 'nginx:latest')" + )] + pub image: Option, + + #[arg(short = 'n', long = "name", help = "Environment to add the service to")] + pub env_name: String, +} diff --git a/src/main.rs b/src/main.rs index 8a9ce23..7c50523 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,14 +3,21 @@ use std::io; use sailr::{ builder::{split_matches, Builder}, cli::{Cli, Commands, InfraCommands, K8sCommands, Provider}, - create_default_env_config, create_default_env_infra, - environment::Environment, + create_default_env_config, + create_default_env_infra, + environment::{Environment, Service}, // Added Service errors::CliError, generate, infra::{local_k8s::LocalK8, Infra}, - templates::TemplateManager, + templates::{ + scaffolding::{generate_config_map, generate_deployment, generate_service}, // Added scaffolding functions + TemplateManager, + }, LOGGER, + // filesystem::FileSystemManager, // FileSystemManager is not directly used here, fs is used. }; +use std::fs; +use std::path::Path; // Path was already here use anyhow::Result; @@ -33,7 +40,11 @@ async fn main() -> Result<(), CliError> { ); if let Some(template_path) = arg.infra_template_path { - create_default_env_infra(arg.name, Some(template_path), arg.default_registry) + create_default_env_infra( + arg.name.clone(), + Some(template_path), + arg.default_registry, + ) } else if let Some(provider) = arg.provider { let infra = match provider { Provider::Local => Infra::new(Box::new(LocalK8::new(arg.name.clone()))), @@ -45,9 +56,132 @@ async fn main() -> Result<(), CliError> { infra.generate(Infra::read_config(arg.name.clone())); infra.build(Infra::read_config(arg.name.clone())); } else { - let infra = Infra::new(Box::new(LocalK8::new(arg.name.clone()))); - infra.generate(Infra::read_config(arg.name.clone())); - infra.build(Infra::read_config(arg.name.clone())); + // No default infrastructure provisioning. + // Infrastructure will only be set up if explicitly requested + // via --provider or --infra-templates options, or later using 'sailr infra up'. + LOGGER.info("No infrastructure provider specified, skipping default infrastructure setup. Use 'sailr infra up' to provision later if needed."); + } + + // Add default "sample-app" service + let sample_service_name = "sample-app".to_string(); + let sample_app_type = "web-app".to_string(); + let sample_image = "nginx:latest".to_string(); + let sample_replicas = 1; + let sample_port = 80; + + let sample_service_template_path_str = format!("k8s/templates/{}", sample_service_name); + let sample_service_template_path = Path::new(&sample_service_template_path_str); + + match fs::create_dir_all(sample_service_template_path) { + Ok(_) => LOGGER.info(&format!( + "Created directory for sample-app: {}", + sample_service_template_path.display() + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to create directory for sample-app {}: {}", + sample_service_template_path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to create directory for sample-app: {}", + e + ))); + } + } + + let deployment_content = generate_deployment( + &sample_service_name, + &sample_app_type, + &sample_image, + sample_replicas, + sample_port, + ); + let service_content = + generate_service(&sample_service_name, &sample_app_type, sample_port); + let config_map_content = generate_config_map(&sample_service_name, &sample_app_type); + + let deployment_file_path = sample_service_template_path.join("deployment.yaml"); + let service_file_path = sample_service_template_path.join("service.yaml"); + let config_map_file_path = sample_service_template_path.join("configmap.yaml"); + + for (path, content) in &[ + (&deployment_file_path, deployment_content), + (&service_file_path, service_content), + (&config_map_file_path, config_map_content), + ] { + match fs::write(path, content) { + Ok(_) => { + LOGGER.info(&format!("Created sample-app manifest: {}", path.display())) + } + Err(e) => { + LOGGER.error(&format!( + "Failed to write sample-app manifest {}: {}", + path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to write sample-app manifest: {}", + e + ))); + } + } + } + + // Update the new environment's config.toml with sample-app + let env_name = arg.name.clone(); + match Environment::load_from_file(&env_name) { + Ok(mut env) => { + let sample_service_entry = Service::new( + "sample-app", + "default", + Some("sample-app"), + None, // build + None, // major_version + None, // minor_version + None, // patch_version + Some("latest".to_string()), // tag + ); + + if env + .service_whitelist + .iter() + .any(|s| s.name == sample_service_entry.name) + { + LOGGER.warn(&format!( + "Sample service {} already exists in environment {}, skipping addition.", + sample_service_name, env_name + )); + } else { + env.service_whitelist.push(sample_service_entry); + match env.save_to_file() { + Ok(_) => LOGGER.info(&format!( + "Added sample-app service to environment {} config.", + env_name + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to save updated config for environment {}: {}", + env_name, e + )); + return Err(CliError::Other(format!( + "Failed to save config for sample-app: {}", + e + ))); + } + } + } + } + Err(e) => { + LOGGER.error(&format!( + "Failed to load environment {} to add sample-app: {}", + env_name, e + )); + return Err(CliError::Other(format!( + "Failed to load environment config for sample-app: {}", + e + ))); + } } } Commands::Completions(arg) => { @@ -474,6 +608,173 @@ async fn main() -> Result<(), CliError> { }, } } + Commands::AddService(args) => { + LOGGER.info(&format!( + "Adding new service: {} of type {}", + args.service_name, args.app_type + )); + + let service_template_path_str = format!("k8s/templates/{}", args.service_name); + let service_template_path = Path::new(&service_template_path_str); + + match fs::create_dir_all(service_template_path) { + Ok(_) => { + if service_template_path.exists() { + LOGGER.info(&format!( + "Directory {} already existed or was created successfully.", + service_template_path.display() + )); + } else { + // This case should ideally not be reached if create_dir_all is successful + // but fs::create_dir_all doesn't error if path already exists. + // We log it just in case. + LOGGER.info(&format!( + "Directory {} created successfully.", + service_template_path.display() + )); + } + } + Err(e) => { + LOGGER.error(&format!( + "Failed to create directory {}: {}", + service_template_path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to create directory {}: {}", + service_template_path.display(), + e + ))); + } + } + + // Template Generation + let image = args.image.unwrap_or("nginx".to_string()); // Default image + let replicas = 1; // Default replicas + let port = args.port.unwrap_or(80); // Default port + + let deployment_content = + generate_deployment(&args.service_name, &args.app_type, &image, replicas, port); + let service_content = generate_service(&args.service_name, &args.app_type, port); + let config_map_content = generate_config_map(&args.service_name, &args.app_type); + + let deployment_file_path = service_template_path.join("deployment.yaml"); + let service_file_path = service_template_path.join("service.yaml"); + let config_map_file_path = service_template_path.join("configmap.yaml"); + + match fs::write(&deployment_file_path, deployment_content) { + Ok(_) => LOGGER.info(&format!( + "Created deployment manifest: {}", + deployment_file_path.display() + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to write deployment manifest {}: {}", + deployment_file_path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to write deployment manifest: {}", + e + ))); + } + } + + match fs::write(&service_file_path, service_content) { + Ok(_) => LOGGER.info(&format!( + "Created service manifest: {}", + service_file_path.display() + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to write service manifest {}: {}", + service_file_path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to write service manifest: {}", + e + ))); + } + } + + match fs::write(&config_map_file_path, config_map_content) { + Ok(_) => LOGGER.info(&format!( + "Created configmap manifest: {}", + config_map_file_path.display() + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to write configmap manifest {}: {}", + config_map_file_path.display(), + e + )); + return Err(CliError::Other(format!( + "Failed to write configmap manifest: {}", + e + ))); + } + } + + // config.toml update + let env_name = args.env_name.to_string(); // Fixed environment name for now + match Environment::load_from_file(&env_name) { + Ok(mut env) => { + let new_service = Service::new( + &args.service_name, + "default", + Some(args.service_name.as_str()), // path + None, // build + None, // major_version + None, // minor_version + None, // patch_version + Some("latest".to_string()), // tag + ); + + // Check if service already exists to prevent duplicates + if env + .service_whitelist + .iter() + .any(|s| s.name == new_service.name) + { + LOGGER.warn(&format!( + "Service {} already exists in environment {}, skipping addition to config.toml.", + args.service_name, env_name + )); + } else { + env.service_whitelist.push(new_service); + match env.save_to_file() { + Ok(_) => LOGGER.info(&format!( + "Updated config.toml for environment {} with new service {}.", + env_name, args.service_name + )), + Err(e) => { + LOGGER.error(&format!( + "Failed to save updated config.toml for environment {}: {}", + env_name, e + )); + return Err(CliError::Other(format!( + "Failed to save config.toml: {}", + e + ))); + } + } + } + } + Err(e) => { + // If the develop.toml doesn't exist, we might want to create it + // or instruct the user. For now, just error out. + LOGGER.error(&format!( + "Failed to load environment {}.toml: {}. Please ensure it exists or run 'sailr init {}' first.", + env_name, e, env_name + )); + return Err(CliError::Other(format!( + "Failed to load environment {}.toml: {}", + env_name, e + ))); + } + } + } } Ok(()) diff --git a/src/templates/mod.rs b/src/templates/mod.rs index bddfd24..619950b 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -4,6 +4,8 @@ use scribe_rust::{log, Color}; use crate::{config::Config, environment::Environment, filesystem::FileSystemManager}; +pub mod scaffolding; + #[derive(Clone, Debug)] pub struct Template { pub name: String, diff --git a/src/templates/scaffolding.rs b/src/templates/scaffolding.rs new file mode 100644 index 0000000..ef1f551 --- /dev/null +++ b/src/templates/scaffolding.rs @@ -0,0 +1,70 @@ +// src/templates/scaffolding.rs + +pub fn generate_deployment( + service_name: &str, + _app_type: &str, + image: &str, + replicas: u8, + port: u16, +) -> String { + format!( + r#"apiVersion: apps/v1 +kind: Deployment +metadata: + name: {service_name} + labels: + app: {service_name} +spec: + replicas: {replicas} + selector: + matchLabels: + app: {service_name} + template: + metadata: + labels: + app: {service_name} + spec: + containers: + - name: {service_name} + image: {image} + ports: + - containerPort: {port} # Default, consider making this configurable later +"#, + service_name = service_name, + replicas = replicas, + image = image, + port = port + ) +} + +pub fn generate_service(service_name: &str, _app_type: &str, port: u16) -> String { + format!( + r#"apiVersion: v1 +kind: Service +metadata: + name: {service_name} +spec: + selector: + app: {service_name} + ports: + - protocol: TCP + port: {port} + targetPort: {port} # Default, should ideally match containerPort +"#, + service_name = service_name, + port = port + ) +} + +pub fn generate_config_map(service_name: &str, _app_type: &str) -> String { + format!( + r#"apiVersion: v1 +kind: ConfigMap +metadata: + name: {service_name}-config +data: + EXAMPLE_KEY: "example_value" +"#, + service_name = service_name + ) +} diff --git a/test_workspace/config.toml b/test_workspace/config.toml new file mode 100644 index 0000000..7411aae --- /dev/null +++ b/test_workspace/config.toml @@ -0,0 +1,44 @@ +schema_version = "0.2.0" +name = "testenv" +log_level = "INFO" +domain = "example.com" +default_replicas = 1 +registry = "docker.io" + +[[service_whitelist]] +path = "" +version = "latest" +name = "default/test" + +[[service_whitelist]] +name = "test-namespace/test2" +path = "core/test2" +version = "1.2.0" +build = "./test" + +[[service_whitelist]] +path = "sample-app" +version = "latest" +name = "default/sample-app" + +[build] +beforeAll = "echo 'do something before'" + +[build.rooms.test] +path = "./test" +include = "./**/*.*" +after = "docker push test:latest" + +[build.rooms.test2] +path = "./test2" +include = "./**/*.*" +before = "docker build -t docker.io/test2:latest ." +after = "docker push docker.io/test2:latest" + +[[environment_variables]] +name = "REDIS_HOST" +value = "redis" + +[[environment_variables]] +name = "REDIS_PORT" +value = "6379" diff --git a/test_workspace/k8s/environments/develop/.terraform.lock.hcl b/test_workspace/k8s/environments/develop/.terraform.lock.hcl new file mode 100644 index 0000000..421a651 --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform.lock.hcl @@ -0,0 +1,36 @@ +# This file is maintained automatically by "tofu init". +# Manual edits may be lost in future updates. + +provider "registry.opentofu.org/hashicorp/local" { + version = "2.5.3" + hashes = [ + "h1:31Clmfoe7hzkcdgwuhUuGuPGfeG2Ksk+YWcJgzBTN7M=", + "zh:32e1d4b0595cea6cda4ca256195c162772ddff25594ab4008731a2ec7be230bf", + "zh:48c390af0c87df994ec9796f04ec2582bcac581fb81ed6bb58e0671da1c17991", + "zh:4be7289c969218a57b40902e2f359914f8d35a7f97b439140cb711aa21e494bd", + "zh:4cf958e631e99ed6c8b522c9b22e1f1b568c0bdadb01dd002ca7dffb1c927764", + "zh:7a0132c0faca4c4c96aa70808effd6817e28712bf5a39881666ac377b4250acf", + "zh:7d60de08fac427fb045e4590d1b921b6778498eee9eb16f78c64d4c577bde096", + "zh:91003bee5981e99ec3925ce2f452a5f743827f9d0e131a86613549c1464796f0", + "zh:9fe2fe75977c8149e2515fb30c6cc6cfd57b225d4ce592c570d81a3831d7ffa3", + "zh:e210e6be54933ce93e03d0994e520ba289aa01b2c1f70e77afb8f2ee796b0fe3", + "zh:e8793e5f9422f2b31a804e51806595f335b827c9a38db18766960464566f21d5", + ] +} + +provider "registry.opentofu.org/hashicorp/null" { + version = "3.2.4" + hashes = [ + "h1:i+WKhUHL2REY5EGmiHjfUljJB8UKZ9QdhdM5uTeUhC4=", + "zh:1769783386610bed8bb1e861a119fe25058be41895e3996d9216dd6bb8a7aee3", + "zh:32c62a9387ad0b861b5262b41c5e9ed6e940eda729c2a0e58100e6629af27ddb", + "zh:339bf8c2f9733fce068eb6d5612701144c752425cebeafab36563a16be460fb2", + "zh:36731f23343aee12a7e078067a98644c0126714c4fe9ac930eecb0f2361788c4", + "zh:3d106c7e32a929e2843f732625a582e562ff09120021e510a51a6f5d01175b8d", + "zh:74bcb3567708171ad83b234b92c9d63ab441ef882b770b0210c2b14fdbe3b1b6", + "zh:90b55bdbffa35df9204282251059e62c178b0ac7035958b93a647839643c0072", + "zh:ae24c0e5adc692b8f94cb23a000f91a316070fdc19418578dcf2134ff57cf447", + "zh:b5c10d4ad860c4c21273203d1de6d2f0286845edf1c64319fa2362df526b5f58", + "zh:e05bbd88e82e1d6234988c85db62fd66f11502645838fff594a2ec25352ecd80", + ] +} diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/CHANGELOG.md b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/CHANGELOG.md new file mode 100644 index 0000000..c2ee5da --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/CHANGELOG.md @@ -0,0 +1,185 @@ +## 2.5.3 (May 08, 2025) + +NOTES: + +* Update dependencies ([#404](https://github.com/hashicorp/terraform-provider-local/issues/404)) + +## 2.5.3-alpha1 (April 24, 2025) + +NOTES: + +* This release is being used to test new build and release actions. ([#405](https://github.com/hashicorp/terraform-provider-local/issues/405)) + +## 2.5.2 (September 11, 2024) + +NOTES: + +* all: This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#348](https://github.com/hashicorp/terraform-provider-local/issues/348)) + +## 2.5.1 (March 11, 2024) + +NOTES: + +* No functional changes from v2.5.0. Minor documentation fixes. ([#303](https://github.com/hashicorp/terraform-provider-local/issues/303)) + +## 2.5.0 (March 11, 2024) + +FEATURES: + +* functions/direxists: Added a new `direxists` function that checks for the existence of a directory, similar to the built-in `fileexists` function. ([#285](https://github.com/hashicorp/terraform-provider-local/issues/285)) + +## 2.4.1 (December 12, 2023) + +NOTES: + +* This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#273](https://github.com/hashicorp/terraform-provider-local/issues/273)) + +## 2.4.0 (March 08, 2023) + +NOTES: + +* This Go module has been updated to Go 1.19 per the [Go support policy](https://golang.org/doc/devel/release.html#policy). Any consumers building on earlier Go versions may experience errors. ([#184](https://github.com/hashicorp/terraform-provider-local/issues/184)) + +FEATURES: + +* resource/local_file: added support for `MD5`, `SHA1`, `SHA256`, and `SHA512` checksum outputs. ([#142](https://github.com/hashicorp/terraform-provider-local/issues/142)) +* resource/local_sensitive_file: added support for `MD5`, `SHA1`, `SHA256`, and `SHA512` checksum outputs. ([#142](https://github.com/hashicorp/terraform-provider-local/issues/142)) +* data-source/local_file: added support for `MD5`, `SHA1`, `SHA256`, and `SHA512` checksum outputs. ([#142](https://github.com/hashicorp/terraform-provider-local/issues/142)) +* data-source/local_sensitive-file: added support for `MD5`, `SHA1`, `SHA256`, and `SHA512` checksum outputs. ([#142](https://github.com/hashicorp/terraform-provider-local/issues/142)) + +## 2.3.0 (January 11, 2023) + +NOTES: + +* provider: Rewritten to use the [`terraform-plugin-framework`](https://www.terraform.io/plugin/framework) ([#155](https://github.com/hashicorp/terraform-provider-local/issues/155)) + +## 2.2.3 (May 18, 2022) + +NOTES: + +* resource/local_file: Update docs to prevent confusion that exactly one of the arguments `content`, + `sensitive_content`, `content_base64`, and `source` needs to be specified ([#123](https://github.com/hashicorp/terraform-provider-local/pull/123)). + +* resource/local_sensitive_file: Update docs to prevent confusion that exactly one of the arguments `content`, + `content_base64`, and `source` needs to be specified ([#123](https://github.com/hashicorp/terraform-provider-local/pull/123)). + +* No functional changes from 2.2.2. + +## 2.2.2 (March 11, 2022) + +NOTES: + +* resource/local_sensitive_file: Fixed typo in documentation (default permission is `"0700"`, not `"0777"`). +* No functional changes from 2.2.1. + +## 2.2.1 (March 10, 2022) + +NOTES: + +* This release is a republishing of the 2.2.0 release to fix release asset checksum errors. It is identical otherwise. + +## 2.2.0 (March 10, 2022) + +NOTES: + +* resource/local_file: Argument `sensitive_content` is `Deprecated`. For creating or accessing files containing sensitive data, + please use the new resource and data source `local_sensitive_file`. + Both are identical to their `local_file` counterparts, but `content` and `content_base64` attributes are marked as _sensitive_. + +FEATURES: + +* **New Data Source:** `local_sensitive_file` ([#101](https://github.com/hashicorp/terraform-provider-local/pull/101) and [#106](https://github.com/hashicorp/terraform-provider-local/pull/106)) +* **New Resource:** `local_sensitive_file` ([#106](https://github.com/hashicorp/terraform-provider-local/pull/106)) + +## 2.1.0 (February 19, 2021) + +NOTES: + +* Binary releases of this provider now include the` darwin-arm64` platform. +* This version contains no further changes. + +## 2.0.0 (October 14, 2020) + +NOTES: + +* Binary releases of this provider now include the `linux-arm64` platform. + +BREAKING CHANGES: + +* Upgrade to version 2 of the Terraform Plugin SDK, which drops support for Terraform 0.11. + This provider will continue to work as expected for users of Terraform 0.11, which will not download the new version. + ([#42](https://github.com/terraform-providers/terraform-provider-local/issues/42)) + +FEATURES: + +* resource/local_file: Added `source` attribute as alternative way to provide content + for the `local_file` resource. + ([#44](https://github.com/terraform-providers/terraform-provider-local/issues/44)) + +## 1.4.0 (September 30, 2019) + +NOTES: + +* The provider has switched to the standalone TF SDK, there should be no noticeable impact on compatibility. + ([#32](https://github.com/terraform-providers/terraform-provider-local/issues/32)) + +FEATURES: + +* resource/local_file: Added support for configurable permissions + ([#30](https://github.com/terraform-providers/terraform-provider-local/issues/30)) + +## 1.3.0 (June 26, 2019) + +FEATURES: + +* resource/local_file: Added support for base64 encoded content + ([#29](https://github.com/terraform-providers/terraform-provider-local/issues/29)) +* data-source/local_file: Added support for base64 encoded content + ([#29](https://github.com/terraform-providers/terraform-provider-local/issues/29)) + +## 1.2.2 (May 01, 2019) + +NOTES: + +* This releases includes another Terraform SDK upgrade intended to align with that being used for other providers + as we prepare for the Core `v0.12.0` release. It should have no significant changes in behavior for this provider. + +## 1.2.1 (April 11, 2019) + +NOTES: + +* This releases includes only a Terraform SDK upgrade intended to align with that being used for other providers + as we prepare for the Core `v0.12.0` release. It should have no significant changes in behavior for this provider. + +## 1.2.0 (March 20, 2019) + +FEATURES: + +* The provider is now compatible with Terraform v0.12, while retaining compatibility with prior versions. +* resource/local_file: added optional `sensitive_content` attribute, which can be used instead of `content` + in situations where the content contains sensitive information that should not be displayed in a rendered diff. + ([#9](https://github.com/terraform-providers/terraform-provider-local/issues/9)) + +## 1.1.0 (January 04, 2018) + +FEATURES: + +* data-source/local_file: Added for reading files in a way that participates in Terraform's dependency graph, + which allows reading of files that are created dynamically during `terraform apply`. + ([#6](https://github.com/terraform-providers/terraform-provider-local/issues/6)) + +## 1.0.0 (September 15, 2017) + +NOTES: + +* No changes from 0.1.0; just adjusting to + [the new version numbering scheme](https://www.hashicorp.com/blog/hashicorp-terraform-provider-versioning/). + +## 0.1.0 (June 21, 2017) + +NOTES: + +* Same functionality as that of Terraform 0.9.8. + Repacked as part of [Provider Splitout](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/) + + diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/LICENSE b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/LICENSE new file mode 100644 index 0000000..b9ac071 --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/LICENSE @@ -0,0 +1,375 @@ +Copyright (c) 2017 HashiCorp, Inc. + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/README.md b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/README.md new file mode 100644 index 0000000..a99aa67 --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/README.md @@ -0,0 +1,125 @@ +# Terraform Provider: Local + +The Local provider is used to manage local resources, such as files. + + +**Note** Terraform primarily deals with remote resources which are able +to outlive a single Terraform run, and so local resources can sometimes violate +its assumptions. The resources here are best used with care, since depending +on local state can make it hard to apply the same Terraform configuration on +many different local systems where the local resources may not be universally +available. See specific notes in each resource for more information. + + +## Documentation, questions and discussions + +Official documentation on how to use this provider can be found on the +[Terraform Registry](https://registry.terraform.io/providers/hashicorp/local/latest/docs). +In case of specific questions or discussions, please use the +HashiCorp [Terraform Providers Discuss forums](https://discuss.hashicorp.com/c/terraform-providers/31), +in accordance with HashiCorp [Community Guidelines](https://www.hashicorp.com/community-guidelines). + +We also provide: + +* [Support](.github/SUPPORT.md) page for help when using the provider +* [Contributing](.github/CONTRIBUTING.md) guidelines in case you want to help this project + +The remainder of this document will focus on the development aspects of the provider. + +## Compatibility + +Compatibility table between this provider, the [Terraform Plugin Protocol](https://www.terraform.io/plugin/how-terraform-works#terraform-plugin-protocol) +version it implements, and Terraform: + +| TLS Provider | Terraform Plugin Protocol | Terraform | +|:------------:|:-------------------------:|:---------:| +| `>= 2.x` | `5` | `>= 0.12` | +| `>= 1.1.x` | `4` and `5` | `<= 0.12` | +| `>= 0.x` | `4` | `<= 0.11` | + +Details can be found querying the [Registry API](https://www.terraform.io/internals/provider-registry-protocol#list-available-versions) +that return all the details about which version are currently available for a particular provider. +[Here](https://registry.terraform.io/v1/providers/hashicorp/local/versions) are the details for Local (JSON response). + +## Requirements + +* [Terraform](https://www.terraform.io/downloads) +* [Go](https://go.dev/doc/install) (1.23) +* [GNU Make](https://www.gnu.org/software/make/) +* [golangci-lint](https://golangci-lint.run/usage/install/#local-installation) (optional) + +## Development + +### Building + +1. `git clone` this repository and `cd` into its directory +2. `make` will trigger the Golang build + +The provided `GNUmakefile` defines additional commands generally useful during development, +like for running tests, generating documentation, code formatting and linting. +Taking a look at it's content is recommended. + +### Testing + +In order to test the provider, you can run + +* `make test` to run provider tests +* `make testacc` to run provider acceptance tests + +It's important to note that acceptance tests (`testacc`) will actually spawn +`terraform` and the provider. Read more about they work on the +[official page](https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests). + +### Generating documentation + +This provider uses [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs/) +to generate documentation and store it in the `docs/` directory. +Once a release is cut, the Terraform Registry will download the documentation from `docs/` +and associate it with the release version. Read more about how this works on the +[official page](https://www.terraform.io/registry/providers/docs). + +Use `make generate` to ensure the documentation is regenerated with any changes. + +### Using a development build + +If [running tests and acceptance tests](#testing) isn't enough, it's possible to set up a local terraform configuration +to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI +[configuration file development overrides](https://www.terraform.io/cli/config/config-file#development-overrides-for-provider-developers). + +First, use `make install` to place a fresh development build of the provider in your +[`${GOBIN}`](https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies) +(defaults to `${GOPATH}/bin` or `${HOME}/go/bin` if `${GOPATH}` is not set). Repeat +this every time you make changes to the provider locally. + +Then, setup your environment following [these instructions](https://www.terraform.io/plugin/debugging#terraform-cli-development-overrides) +to make your local terraform use your local build. + +### Testing GitHub Actions + +This project uses [GitHub Actions](https://docs.github.com/en/actions/automating-builds-and-tests) to realize its CI. + +Sometimes it might be helpful to locally reproduce the behaviour of those actions, +and for this we use [act](https://github.com/nektos/act). Once installed, you can _simulate_ the actions executed +when opening a PR with: + +```shell +# List of workflows for the 'pull_request' action +$ act -l pull_request + +# Execute the workflows associated with the `pull_request' action +$ act pull_request +``` + +## Releasing + +The releasable builds are generated from the [build GH workflow](./.github/workflows/build.yml) and the release/promotion process +is completed via internal HashiCorp deployment tooling. Prior to release, the changelog should be updated in `main` with +the changie tool, example: + +```sh +changie batch 2.5.3 && changie merge +``` + +## License + +[Mozilla Public License v2.0](./LICENSE) diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local new file mode 100755 index 0000000..82491ed Binary files /dev/null and b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local differ diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md new file mode 100644 index 0000000..adf9fac --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md @@ -0,0 +1,92 @@ +## 3.2.4 (April 21, 2025) + +NOTES: + +* Dependency updates ([#421](https://github.com/hashicorp/terraform-provider-null/issues/421)) + +## 3.2.4-alpha1 (February 19, 2025) + +NOTES: + +* all: This release is being used to test new build and release actions. + +## 3.2.4-alpha.2 (March 27, 2025) + +NOTES: + +* all: This release is being used to test new build and release actions. + +## 3.2.3 (September 11, 2024) + +NOTES: + +* all: This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#366](https://github.com/hashicorp/terraform-provider-null/issues/366)) + +## 3.2.2 (November 20, 2023) + +NOTES: + +* This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#242](https://github.com/hashicorp/terraform-provider-null/issues/242)) + +## 3.2.1 (November 17, 2022) + +BUG FIXES: + +* provider: Fix random number generation for `id` attributes ([#160](https://github.com/hashicorp/terraform-provider-null/pull/160)) + +## 3.2.0 (October 25, 2022) + +NOTES: + +* Provider: Rewritten to use the new [`terraform-plugin-framework`](https://www.terraform.io/plugin/framework) ([#150](https://github.com/hashicorp/terraform-provider-null/pull/150)) + +## 3.1.1 (March 16, 2022) + +NOTES: + +* Updated [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs) to `v0.7.0`: + this improves generated documentation, with attributes now correctly formatted as `code` + and provided with anchors. +* Functionally identical to the previous 3.1.0 release. + +## 3.1.0 (February 19, 2021) + +Binary releases of this provider now include the darwin-arm64 platform. This version contains no further changes. + +## 3.0.0 (October 08, 2020) + +Binary releases of this provider now include the linux-arm64 platform. + +BREAKING CHANGES: + +* Upgrade to version 2 of the Terraform Plugin SDK, which drops support for Terraform 0.11. This provider will continue to work as expected for users of Terraform 0.11, which will not download the new version. ([#47](https://github.com/terraform-providers/terraform-provider-null/issues/47)) + +## 2.1.2 (April 30, 2019) + +* This releases includes another Terraform SDK upgrade intended to align with that being used for other providers as we prepare for the Core v0.12.0 release. It should have no significant changes in behavior for this provider. + +## 2.1.1 (April 11, 2019) + +* This releases includes only a Terraform SDK upgrade intended to align with that being used for other providers as we prepare for the Core v0.12.0 release. It should have no significant changes in behavior for this provider. + +## 2.1.0 (February 27, 2019) + +IMPROVEMENTS: + +* The previous release contains an SDK incompatible with TF 0.12. Fortunately 0.12 was not released yet so upgrading the vendored sdk makes this release compatible with 0.12. + +## 2.0.0 (January 18, 2019) + +IMPROVEMENTS: + +* The provider is now compatible with Terraform v0.12, while retaining compatibility with prior versions. + +## 1.0.0 (September 26, 2017) + +* No changes from 0.1.0; just adjusting to [the new version numbering scheme](https://www.hashicorp.com/blog/hashicorp-terraform-provider-versioning/). + +## 0.1.0 (June 21, 2017) + +NOTES: + +* Same functionality as that of Terraform 0.9.8. Repacked as part of [Provider Splitout](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/) diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE new file mode 100644 index 0000000..b9ac071 --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE @@ -0,0 +1,375 @@ +Copyright (c) 2017 HashiCorp, Inc. + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md new file mode 100644 index 0000000..8c0d19b --- /dev/null +++ b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md @@ -0,0 +1,113 @@ +# Terraform Provider: Null + +The Null provider is a rather-unusual provider that has constructs that intentionally do nothing. This may sound strange, and indeed these constructs do not need to be used in most cases, but they can be useful in various situations to help orchestrate tricky behavior or work around limitations. + +## Requirements + +* [Terraform](https://www.terraform.io/downloads) +* [Go](https://go.dev/doc/install) (1.23) +* [GNU Make](https://www.gnu.org/software/make/) +* [golangci-lint](https://golangci-lint.run/usage/install/#local-installation) (optional) + +## Documentation, questions and discussions +Official documentation on how to use this provider can be found on the +[Terraform Registry](https://registry.terraform.io/providers/hashicorp/null/latest/docs). +In case of specific questions or discussions, please use the +HashiCorp [Terraform Providers Discuss forums](https://discuss.hashicorp.com/c/terraform-providers/31), +in accordance with HashiCorp [Community Guidelines](https://www.hashicorp.com/community-guidelines). + +We also provide: + +* [Support](.github/SUPPORT.md) page for help when using the provider +* [Contributing](.github/CONTRIBUTING.md) guidelines in case you want to help this project + +## Compatibility + +Compatibility table between this provider, the [Terraform Plugin Protocol](https://www.terraform.io/plugin/how-terraform-works#terraform-plugin-protocol) +version it implements, and Terraform: + +| Null Provider | Terraform Plugin Protocol | Terraform | +|:-------------:|:-------------------------:|:---------:| +| `>= 3.0.x` | `5` | `>= 0.12` | +| `>= 2.1.x` | `4` and `5` | `>= 0.12` | +| `>= 2.x.x` | `4` | `<= 0.12` | +| `>= 1.x.x` | `4` | `<= 0.12` | +| `>= 0.1.x` | `4` | `<= 0.12` | + +Details can be found querying the [Registry API](https://www.terraform.io/internals/provider-registry-protocol#list-available-versions) +that return all the details about which version are currently available for a particular provider. +[Here](https://registry.terraform.io/v1/providers/hashicorp/null/versions) are the details for Time (JSON response). + + +## Development + +### Building + +1. `git clone` this repository and `cd` into its directory +2. `make` will trigger the Golang build + +The provided `GNUmakefile` defines additional commands generally useful during development, +like for running tests, generating documentation, code formatting and linting. +Taking a look at it's content is recommended. + +### Testing + +In order to test the provider, you can run + +* `make test` to run provider tests +* `make testacc` to run provider acceptance tests + +It's important to note that acceptance tests (`testacc`) will actually spawn +`terraform` and the provider. Read more about they work on the +[official page](https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests). + +### Generating documentation + +This provider uses [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs/) +to generate documentation and store it in the `docs/` directory. +Once a release is cut, the Terraform Registry will download the documentation from `docs/` +and associate it with the release version. Read more about how this works on the +[official page](https://www.terraform.io/registry/providers/docs). + +Use `make generate` to ensure the documentation is regenerated with any changes. + +### Using a development build + +If [running tests and acceptance tests](#testing) isn't enough, it's possible to set up a local terraform configuration +to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI +[configuration file development overrides](https://www.terraform.io/cli/config/config-file#development-overrides-for-provider-developers). + +First, use `make install` to place a fresh development build of the provider in your +[`${GOBIN}`](https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies) +(defaults to `${GOPATH}/bin` or `${HOME}/go/bin` if `${GOPATH}` is not set). Repeat +this every time you make changes to the provider locally. + +Then, setup your environment following [these instructions](https://www.terraform.io/plugin/debugging#terraform-cli-development-overrides) +to make your local terraform use your local build. + +### Testing GitHub Actions + +This project uses [GitHub Actions](https://docs.github.com/en/actions/automating-builds-and-tests) to realize its CI. + +Sometimes it might be helpful to locally reproduce the behaviour of those actions, +and for this we use [act](https://github.com/nektos/act). Once installed, you can _simulate_ the actions executed +when opening a PR with: + +```shell +# List of workflows for the 'pull_request' action +$ act -l pull_request + +# Execute the workflows associated with the `pull_request' action +$ act pull_request +``` + +## Releasing + +The release process is automated via GitHub Actions, and it's defined in the Workflow +[release.yml](./.github/workflows/release.yml). + +Each release is cut by pushing a [semantically versioned](https://semver.org/) tag to the default branch. + +## License + +[Mozilla Public License v2.0](./LICENSE) \ No newline at end of file diff --git a/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null new file mode 100755 index 0000000..3bc0178 Binary files /dev/null and b/test_workspace/k8s/environments/develop/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null differ diff --git a/test_workspace/k8s/environments/develop/config.toml b/test_workspace/k8s/environments/develop/config.toml new file mode 100644 index 0000000..a3ce49b --- /dev/null +++ b/test_workspace/k8s/environments/develop/config.toml @@ -0,0 +1,63 @@ +schema_version = "0.2.0" # here for cli compatability check. leave as this, unless sailr specifies. +# schema_version changes could indicate breaking changes or new features or patches to sailr config spec. + +# Global config, all can be reference in templates as their name ie {{domain}} will be replaced with the domain value. + +name = "develop" +log_level = "INFO" +domain = "example.com" # Replace this with the domain +default_replicas = 1 +registry = "docker.io" # Replace this with the container registry to use if not usign docker.io + + +#----------------------- SERVICES ----------------------------# + +# Example service whitelist +# Service whitelist defines the services that will be +# generated and deployed to the kubernetes cluster. + +# minimal config required for service definition +[[service_whitelist]] +name = "test" # avaliable as `service_name`, name is used to pull the images in the default templates, can be what ever. +version = "latest" # accepts semver versions or tags, avaliable in service templates as `service_version` + +# Defining a service with a set version, and will live in the test-namespace +[[service_whitelist]] +path = "core/test2" # change the template directory relative to the k8s/templates dir +name = "test2" # avaliable as `service_name` +version = "1.2.0" # accepts semver versions or tags, avaliable in service templates as `service_version` +namespace = "test-namespace" # avaliabel as `service_namespace` +build = "./test" # src dir to build code, optional as some service don't + # need to build because they just use remote images. + + +#-------------------------- ENV ------------------------------# + +# Example Environment Variable Definitions +# these will be used when generating the service definitions +# and will be swapped out in the template files on generation. + +[[environment_variables]] +name = "REDIS_HOST" +value = "redis" # this will be injected into templates where ever {{REDIS_HOST}} appears. + +[[environment_variables]] +name = "REDIS_PORT" +value = "6379" # this will be injected into templates where ever {{REDIS_HOST}} appears. + + +#----------------------- BUILD --------------------------# + +# Example Roomservice config +[build] +beforeAll = "echo 'do something before'" # executes before all build steps (globally) from project root + +[build.rooms.test] +path = "./test" # build path, will use this to build the service +run_parallel = "docker build -t test:latest ." # actions to run in parallel across all builds +after = "docker push test:latest" # actions to run after the build step + +[build.rooms.test2] # test2 is the name of the build +path = "./test2" +before = "docker build -t docker.io/test2:latest ." # actions to run before build step, using the default vars +after = "docker push docker.io/test2:latest" # actions to run after the build step, using the default vars diff --git a/test_workspace/k8s/environments/develop/main.tf b/test_workspace/k8s/environments/develop/main.tf new file mode 100644 index 0000000..abc2cc3 --- /dev/null +++ b/test_workspace/k8s/environments/develop/main.tf @@ -0,0 +1,98 @@ +resource "null_resource" "install_k3s" { + provisioner "local-exec" { + command = < 0 ? "" : "--cluster-init"} + EOF + + interpreter = ["bash", "-c"] + when = create # No quotes around create + } + + # Use provisioner triggers to simulate depends_on + triggers = { + install_k3s = timestamp() + } + + # If worker nodes are desired, add them + provisioner "local-exec" { + command = <= 2.x` | `5` | `>= 0.12` | +| `>= 1.1.x` | `4` and `5` | `<= 0.12` | +| `>= 0.x` | `4` | `<= 0.11` | + +Details can be found querying the [Registry API](https://www.terraform.io/internals/provider-registry-protocol#list-available-versions) +that return all the details about which version are currently available for a particular provider. +[Here](https://registry.terraform.io/v1/providers/hashicorp/local/versions) are the details for Local (JSON response). + +## Requirements + +* [Terraform](https://www.terraform.io/downloads) +* [Go](https://go.dev/doc/install) (1.23) +* [GNU Make](https://www.gnu.org/software/make/) +* [golangci-lint](https://golangci-lint.run/usage/install/#local-installation) (optional) + +## Development + +### Building + +1. `git clone` this repository and `cd` into its directory +2. `make` will trigger the Golang build + +The provided `GNUmakefile` defines additional commands generally useful during development, +like for running tests, generating documentation, code formatting and linting. +Taking a look at it's content is recommended. + +### Testing + +In order to test the provider, you can run + +* `make test` to run provider tests +* `make testacc` to run provider acceptance tests + +It's important to note that acceptance tests (`testacc`) will actually spawn +`terraform` and the provider. Read more about they work on the +[official page](https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests). + +### Generating documentation + +This provider uses [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs/) +to generate documentation and store it in the `docs/` directory. +Once a release is cut, the Terraform Registry will download the documentation from `docs/` +and associate it with the release version. Read more about how this works on the +[official page](https://www.terraform.io/registry/providers/docs). + +Use `make generate` to ensure the documentation is regenerated with any changes. + +### Using a development build + +If [running tests and acceptance tests](#testing) isn't enough, it's possible to set up a local terraform configuration +to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI +[configuration file development overrides](https://www.terraform.io/cli/config/config-file#development-overrides-for-provider-developers). + +First, use `make install` to place a fresh development build of the provider in your +[`${GOBIN}`](https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies) +(defaults to `${GOPATH}/bin` or `${HOME}/go/bin` if `${GOPATH}` is not set). Repeat +this every time you make changes to the provider locally. + +Then, setup your environment following [these instructions](https://www.terraform.io/plugin/debugging#terraform-cli-development-overrides) +to make your local terraform use your local build. + +### Testing GitHub Actions + +This project uses [GitHub Actions](https://docs.github.com/en/actions/automating-builds-and-tests) to realize its CI. + +Sometimes it might be helpful to locally reproduce the behaviour of those actions, +and for this we use [act](https://github.com/nektos/act). Once installed, you can _simulate_ the actions executed +when opening a PR with: + +```shell +# List of workflows for the 'pull_request' action +$ act -l pull_request + +# Execute the workflows associated with the `pull_request' action +$ act pull_request +``` + +## Releasing + +The releasable builds are generated from the [build GH workflow](./.github/workflows/build.yml) and the release/promotion process +is completed via internal HashiCorp deployment tooling. Prior to release, the changelog should be updated in `main` with +the changie tool, example: + +```sh +changie batch 2.5.3 && changie merge +``` + +## License + +[Mozilla Public License v2.0](./LICENSE) diff --git a/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local new file mode 100755 index 0000000..82491ed Binary files /dev/null and b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/local/2.5.3/darwin_arm64/terraform-provider-local differ diff --git a/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md new file mode 100644 index 0000000..adf9fac --- /dev/null +++ b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/CHANGELOG.md @@ -0,0 +1,92 @@ +## 3.2.4 (April 21, 2025) + +NOTES: + +* Dependency updates ([#421](https://github.com/hashicorp/terraform-provider-null/issues/421)) + +## 3.2.4-alpha1 (February 19, 2025) + +NOTES: + +* all: This release is being used to test new build and release actions. + +## 3.2.4-alpha.2 (March 27, 2025) + +NOTES: + +* all: This release is being used to test new build and release actions. + +## 3.2.3 (September 11, 2024) + +NOTES: + +* all: This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#366](https://github.com/hashicorp/terraform-provider-null/issues/366)) + +## 3.2.2 (November 20, 2023) + +NOTES: + +* This release introduces no functional changes. It does however include dependency updates which address upstream CVEs. ([#242](https://github.com/hashicorp/terraform-provider-null/issues/242)) + +## 3.2.1 (November 17, 2022) + +BUG FIXES: + +* provider: Fix random number generation for `id` attributes ([#160](https://github.com/hashicorp/terraform-provider-null/pull/160)) + +## 3.2.0 (October 25, 2022) + +NOTES: + +* Provider: Rewritten to use the new [`terraform-plugin-framework`](https://www.terraform.io/plugin/framework) ([#150](https://github.com/hashicorp/terraform-provider-null/pull/150)) + +## 3.1.1 (March 16, 2022) + +NOTES: + +* Updated [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs) to `v0.7.0`: + this improves generated documentation, with attributes now correctly formatted as `code` + and provided with anchors. +* Functionally identical to the previous 3.1.0 release. + +## 3.1.0 (February 19, 2021) + +Binary releases of this provider now include the darwin-arm64 platform. This version contains no further changes. + +## 3.0.0 (October 08, 2020) + +Binary releases of this provider now include the linux-arm64 platform. + +BREAKING CHANGES: + +* Upgrade to version 2 of the Terraform Plugin SDK, which drops support for Terraform 0.11. This provider will continue to work as expected for users of Terraform 0.11, which will not download the new version. ([#47](https://github.com/terraform-providers/terraform-provider-null/issues/47)) + +## 2.1.2 (April 30, 2019) + +* This releases includes another Terraform SDK upgrade intended to align with that being used for other providers as we prepare for the Core v0.12.0 release. It should have no significant changes in behavior for this provider. + +## 2.1.1 (April 11, 2019) + +* This releases includes only a Terraform SDK upgrade intended to align with that being used for other providers as we prepare for the Core v0.12.0 release. It should have no significant changes in behavior for this provider. + +## 2.1.0 (February 27, 2019) + +IMPROVEMENTS: + +* The previous release contains an SDK incompatible with TF 0.12. Fortunately 0.12 was not released yet so upgrading the vendored sdk makes this release compatible with 0.12. + +## 2.0.0 (January 18, 2019) + +IMPROVEMENTS: + +* The provider is now compatible with Terraform v0.12, while retaining compatibility with prior versions. + +## 1.0.0 (September 26, 2017) + +* No changes from 0.1.0; just adjusting to [the new version numbering scheme](https://www.hashicorp.com/blog/hashicorp-terraform-provider-versioning/). + +## 0.1.0 (June 21, 2017) + +NOTES: + +* Same functionality as that of Terraform 0.9.8. Repacked as part of [Provider Splitout](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/) diff --git a/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE new file mode 100644 index 0000000..b9ac071 --- /dev/null +++ b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/LICENSE @@ -0,0 +1,375 @@ +Copyright (c) 2017 HashiCorp, Inc. + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md new file mode 100644 index 0000000..8c0d19b --- /dev/null +++ b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/README.md @@ -0,0 +1,113 @@ +# Terraform Provider: Null + +The Null provider is a rather-unusual provider that has constructs that intentionally do nothing. This may sound strange, and indeed these constructs do not need to be used in most cases, but they can be useful in various situations to help orchestrate tricky behavior or work around limitations. + +## Requirements + +* [Terraform](https://www.terraform.io/downloads) +* [Go](https://go.dev/doc/install) (1.23) +* [GNU Make](https://www.gnu.org/software/make/) +* [golangci-lint](https://golangci-lint.run/usage/install/#local-installation) (optional) + +## Documentation, questions and discussions +Official documentation on how to use this provider can be found on the +[Terraform Registry](https://registry.terraform.io/providers/hashicorp/null/latest/docs). +In case of specific questions or discussions, please use the +HashiCorp [Terraform Providers Discuss forums](https://discuss.hashicorp.com/c/terraform-providers/31), +in accordance with HashiCorp [Community Guidelines](https://www.hashicorp.com/community-guidelines). + +We also provide: + +* [Support](.github/SUPPORT.md) page for help when using the provider +* [Contributing](.github/CONTRIBUTING.md) guidelines in case you want to help this project + +## Compatibility + +Compatibility table between this provider, the [Terraform Plugin Protocol](https://www.terraform.io/plugin/how-terraform-works#terraform-plugin-protocol) +version it implements, and Terraform: + +| Null Provider | Terraform Plugin Protocol | Terraform | +|:-------------:|:-------------------------:|:---------:| +| `>= 3.0.x` | `5` | `>= 0.12` | +| `>= 2.1.x` | `4` and `5` | `>= 0.12` | +| `>= 2.x.x` | `4` | `<= 0.12` | +| `>= 1.x.x` | `4` | `<= 0.12` | +| `>= 0.1.x` | `4` | `<= 0.12` | + +Details can be found querying the [Registry API](https://www.terraform.io/internals/provider-registry-protocol#list-available-versions) +that return all the details about which version are currently available for a particular provider. +[Here](https://registry.terraform.io/v1/providers/hashicorp/null/versions) are the details for Time (JSON response). + + +## Development + +### Building + +1. `git clone` this repository and `cd` into its directory +2. `make` will trigger the Golang build + +The provided `GNUmakefile` defines additional commands generally useful during development, +like for running tests, generating documentation, code formatting and linting. +Taking a look at it's content is recommended. + +### Testing + +In order to test the provider, you can run + +* `make test` to run provider tests +* `make testacc` to run provider acceptance tests + +It's important to note that acceptance tests (`testacc`) will actually spawn +`terraform` and the provider. Read more about they work on the +[official page](https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests). + +### Generating documentation + +This provider uses [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs/) +to generate documentation and store it in the `docs/` directory. +Once a release is cut, the Terraform Registry will download the documentation from `docs/` +and associate it with the release version. Read more about how this works on the +[official page](https://www.terraform.io/registry/providers/docs). + +Use `make generate` to ensure the documentation is regenerated with any changes. + +### Using a development build + +If [running tests and acceptance tests](#testing) isn't enough, it's possible to set up a local terraform configuration +to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI +[configuration file development overrides](https://www.terraform.io/cli/config/config-file#development-overrides-for-provider-developers). + +First, use `make install` to place a fresh development build of the provider in your +[`${GOBIN}`](https://pkg.go.dev/cmd/go#hdr-Compile_and_install_packages_and_dependencies) +(defaults to `${GOPATH}/bin` or `${HOME}/go/bin` if `${GOPATH}` is not set). Repeat +this every time you make changes to the provider locally. + +Then, setup your environment following [these instructions](https://www.terraform.io/plugin/debugging#terraform-cli-development-overrides) +to make your local terraform use your local build. + +### Testing GitHub Actions + +This project uses [GitHub Actions](https://docs.github.com/en/actions/automating-builds-and-tests) to realize its CI. + +Sometimes it might be helpful to locally reproduce the behaviour of those actions, +and for this we use [act](https://github.com/nektos/act). Once installed, you can _simulate_ the actions executed +when opening a PR with: + +```shell +# List of workflows for the 'pull_request' action +$ act -l pull_request + +# Execute the workflows associated with the `pull_request' action +$ act pull_request +``` + +## Releasing + +The release process is automated via GitHub Actions, and it's defined in the Workflow +[release.yml](./.github/workflows/release.yml). + +Each release is cut by pushing a [semantically versioned](https://semver.org/) tag to the default branch. + +## License + +[Mozilla Public License v2.0](./LICENSE) \ No newline at end of file diff --git a/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null new file mode 100755 index 0000000..3bc0178 Binary files /dev/null and b/test_workspace/k8s/environments/testenv/.terraform/providers/registry.opentofu.org/hashicorp/null/3.2.4/darwin_arm64/terraform-provider-null differ diff --git a/test_workspace/k8s/environments/testenv/config.toml b/test_workspace/k8s/environments/testenv/config.toml new file mode 100644 index 0000000..85c78b3 --- /dev/null +++ b/test_workspace/k8s/environments/testenv/config.toml @@ -0,0 +1,63 @@ +schema_version = "0.2.0" # here for cli compatability check. leave as this, unless sailr specifies. +# schema_version changes could indicate breaking changes or new features or patches to sailr config spec. + +# Global config, all can be reference in templates as their name ie {{domain}} will be replaced with the domain value. + +name = "testenv" +log_level = "INFO" +domain = "example.com" # Replace this with the domain +default_replicas = 1 +registry = "docker.io" # Replace this with the container registry to use if not usign docker.io + + +#----------------------- SERVICES ----------------------------# + +# Example service whitelist +# Service whitelist defines the services that will be +# generated and deployed to the kubernetes cluster. + +# minimal config required for service definition +[[service_whitelist]] +name = "test" # avaliable as `service_name`, name is used to pull the images in the default templates, can be what ever. +version = "latest" # accepts semver versions or tags, avaliable in service templates as `service_version` + +# Defining a service with a set version, and will live in the test-namespace +[[service_whitelist]] +path = "core/test2" # change the template directory relative to the k8s/templates dir +name = "test2" # avaliable as `service_name` +version = "1.2.0" # accepts semver versions or tags, avaliable in service templates as `service_version` +namespace = "test-namespace" # avaliabel as `service_namespace` +build = "./test" # src dir to build code, optional as some service don't + # need to build because they just use remote images. + + +#-------------------------- ENV ------------------------------# + +# Example Environment Variable Definitions +# these will be used when generating the service definitions +# and will be swapped out in the template files on generation. + +[[environment_variables]] +name = "REDIS_HOST" +value = "redis" # this will be injected into templates where ever {{REDIS_HOST}} appears. + +[[environment_variables]] +name = "REDIS_PORT" +value = "6379" # this will be injected into templates where ever {{REDIS_HOST}} appears. + + +#----------------------- BUILD --------------------------# + +# Example Roomservice config +[build] +beforeAll = "echo 'do something before'" # executes before all build steps (globally) from project root + +[build.rooms.test] +path = "./test" # build path, will use this to build the service +run_parallel = "docker build -t test:latest ." # actions to run in parallel across all builds +after = "docker push test:latest" # actions to run after the build step + +[build.rooms.test2] # test2 is the name of the build +path = "./test2" +before = "docker build -t docker.io/test2:latest ." # actions to run before build step, using the default vars +after = "docker push docker.io/test2:latest" # actions to run after the build step, using the default vars diff --git a/test_workspace/k8s/environments/testenv/main.tf b/test_workspace/k8s/environments/testenv/main.tf new file mode 100644 index 0000000..abc2cc3 --- /dev/null +++ b/test_workspace/k8s/environments/testenv/main.tf @@ -0,0 +1,98 @@ +resource "null_resource" "install_k3s" { + provisioner "local-exec" { + command = < 0 ? "" : "--cluster-init"} + EOF + + interpreter = ["bash", "-c"] + when = create # No quotes around create + } + + # Use provisioner triggers to simulate depends_on + triggers = { + install_k3s = timestamp() + } + + # If worker nodes are desired, add them + provisioner "local-exec" { + command = < Result<(), CliError> { + // In a real scenario, this function would need to: + // 1. Set the current working directory to test_workspace_root + // 2. Call the specific logic block from main.rs based on the command variant. + // This might involve refactoring main.rs to expose these logic blocks. + + // Placeholder: Directly calling the logic from main.rs for Init + // This is a simplified approach and might need significant adjustments + // depending on the actual structure of main.rs. + // The actual implementation will be done in a later step. + + match command { + Commands::Init(args) => { + sailr::templates::TemplateManager::new().copy_base_templates().unwrap(); + + create_default_env_config( + args.name.clone(), + args.config_template_path, + args.default_registry.clone(), + ); + + if let Some(template_path) = args.infra_template_path { + create_default_env_infra(args.name.clone(), Some(template_path), args.default_registry) + } else if let Some(provider) = args.provider { + let infra = match provider { + Provider::Local => sailr::infra::Infra::new(Box::new(sailr::infra::local_k8s::LocalK8::new(args.name.clone()))), + _ => { + LOGGER.error(&format!("Provider {:?} not supported", provider)); + // In a test, we might panic or return a specific error + return Err(CliError::Other("Unsupported provider".to_string())); + } + }; + infra.generate(sailr::infra::Infra::read_config(args.name.clone())); + infra.build(sailr::infra::Infra::read_config(args.name.clone())); + } else { + // Reflects the updated logic in main.rs: no default infra provisioning + LOGGER.info("No infrastructure provider specified in test, skipping default infrastructure setup."); + } + + // Add default "sample-app" service (logic copied from main.rs) + let sample_service_name = "sample-app".to_string(); + let sample_app_type = "web-app".to_string(); + let sample_image = "nginx:latest".to_string(); + let sample_replicas = 1; + let sample_port = 80; + + let sample_service_template_path_str = + format!("k8s/templates/{}", sample_service_name); + let sample_service_template_path = Path::new(&sample_service_template_path_str); + + fs::create_dir_all(sample_service_template_path).map_err(|e| CliError::Other(format!("Failed to create sample-app dir: {}", e)))?; + LOGGER.info(&format!( + "Created directory for sample-app: {}", + sample_service_template_path.display() + )); + + + let deployment_content = generate_deployment( + &sample_service_name, + &sample_app_type, + &sample_image, + sample_replicas, + ); + let service_content = + generate_service(&sample_service_name, &sample_app_type, sample_port); + let config_map_content = + generate_config_map(&sample_service_name, &sample_app_type); + + let deployment_file_path = + sample_service_template_path.join("deployment.yaml"); + let service_file_path = sample_service_template_path.join("service.yaml"); + let config_map_file_path = + sample_service_template_path.join("configmap.yaml"); + + for (path, content) in &[ + (&deployment_file_path, deployment_content), + (&service_file_path, service_content), + (&config_map_file_path, config_map_content), + ] { + fs::write(path, content).map_err(|e| CliError::Other(format!("Failed to write sample-app manifest: {}", e)))?; + LOGGER.info(&format!( + "Created sample-app manifest: {}", + path.display() + )); + } + + let env_name = args.name.clone(); + match Environment::load_from_file(&env_name) { + Ok(mut env) => { + let sample_service_entry = sailr::environment::Service::new( + &sample_service_name, // name: &str + "default", // namespace: &str + Some(&sample_service_name), // path: Option<&str> + None, // build: Option + None, // major_version: Option + None, // minor_version: Option + None, // patch_version: Option + Some("latest".to_string()), // tag: Option + ); + + if !env.service_whitelist.iter().any(|s| s.name == sample_service_entry.name) { + env.service_whitelist.push(sample_service_entry); + env.save_to_file().map_err(|e| CliError::Other(format!("Failed to save updated config for sample-app: {}", e)))?; + LOGGER.info(&format!( + "Added sample-app service to environment {} config.", + env_name + )); + } else { + LOGGER.warn(&format!( + "Sample service {} already exists in environment {}, skipping addition.", + sample_service_name, env_name + )); + } + } + Err(e) => { + return Err(CliError::Other(format!("Failed to load env to add sample-app: {}", e))); + } + } + } + Commands::AddService(args) => { + LOGGER.info(&format!( + "Adding new service: {} of type {}", + args.service_name, args.app_type + )); + + let service_template_path_str = format!("k8s/templates/{}", args.service_name); + let service_template_path = Path::new(&service_template_path_str); + + fs::create_dir_all(service_template_path).map_err(|e| CliError::Other(format!("Failed to create service dir: {}", e)))?; + LOGGER.info(&format!( + "Directory {} created/existed.", + service_template_path.display() + )); + + let image = "nginx:latest"; + let replicas = 1; + let port = 80; + + let deployment_content = generate_deployment(&args.service_name, &args.app_type, image, replicas); + let service_content = generate_service(&args.service_name, &args.app_type, port); + let config_map_content = generate_config_map(&args.service_name, &args.app_type); + + let deployment_file_path = service_template_path.join("deployment.yaml"); + let service_file_path = service_template_path.join("service.yaml"); + let config_map_file_path = service_template_path.join("configmap.yaml"); + + fs::write(&deployment_file_path, deployment_content).map_err(|e| CliError::Other(format!("Failed to write deployment: {}", e)))?; + fs::write(&service_file_path, service_content).map_err(|e| CliError::Other(format!("Failed to write service: {}", e)))?; + fs::write(&config_map_file_path, config_map_content).map_err(|e| CliError::Other(format!("Failed to write configmap: {}", e)))?; + + LOGGER.info("Generated template files for new service."); + + // For tests, we will use "develop" as the environment name for add-service + let env_name = "develop".to_string(); + match Environment::load_from_file(&env_name) { + Ok(mut env) => { + let new_service = sailr::environment::Service::new( + &args.service_name, // name: &str + "default", // namespace: &str + Some(&args.service_name), // path: Option<&str> + None, // build: Option + None, // major_version: Option + None, // minor_version: Option + None, // patch_version: Option + Some("latest".to_string()), // tag: Option + ); + if !env.service_whitelist.iter().any(|s| s.name == new_service.name) { + env.service_whitelist.push(new_service); + env.save_to_file().map_err(|e| CliError::Other(format!("Failed to save env for new service: {}", e)))?; + LOGGER.info(&format!("Updated env {} for service {}", env_name, args.service_name)); + } else { + LOGGER.warn(&format!("Service {} already in env {}", args.service_name, env_name)); + } + } + Err(e) => { + return Err(CliError::Other(format!("Failed to load env {} to add service: {}", env_name, e))); + } + } + } + // Other commands would be handled here + _ => { + unimplemented!("This command is not yet handled by the test helper."); + } + } + Ok(()) +} + + +const TEST_WORKSPACE_DIR: &str = "./test_workspace"; + +fn get_workspace_path() -> PathBuf { + PathBuf::from(TEST_WORKSPACE_DIR) +} + +fn setup_test_workspace() { + let workspace_path = get_workspace_path(); + if workspace_path.exists() { + fs::remove_dir_all(&workspace_path) + .expect("Failed to remove existing test workspace."); + } + fs::create_dir_all(workspace_path.join("k8s/environments")) + .expect("Failed to create environments directory in test workspace."); + fs::create_dir_all(workspace_path.join("k8s/templates")) + .expect("Failed to create templates directory in test workspace."); +} + +fn cleanup_test_workspace() { + let workspace_path = get_workspace_path(); + if workspace_path.exists() { + fs::remove_dir_all(&workspace_path) + .expect("Failed to remove test workspace."); + } +} + +#[tokio::test] +async fn test_init_creates_sample_app() { + setup_test_workspace(); + let workspace_root = get_workspace_path(); + let original_cwd = std::env::current_dir().unwrap(); + std::env::set_current_dir(&workspace_root).expect("Failed to set CWD to workspace root"); + + let init_args = InitArgs { + name: "testenv".to_string(), + config_template_path: None, + default_registry: None, + provider: None, // Test the case where no provider is specified + infra_template_path: None, + region: None, + }; + + match handle_command(Commands::Init(init_args), &workspace_root).await { + Ok(_) => (), + Err(e) => { + // Restore CWD before panicking + std::env::set_current_dir(&original_cwd).expect("Failed to restore CWD"); + panic!("test_init_creates_sample_app failed during command execution: {:?}", e); + } + } + + // Assertions + let config_path = workspace_root.join("k8s/environments/testenv/config.toml"); + assert!(config_path.exists(), "Config.toml was not created at {:?}", config_path); + + let env_name_for_load = "testenv".to_string(); + let env = Environment::load_from_file(&env_name_for_load) // Pass the environment name as &String + .expect("Failed to load config.toml for testenv"); + assert!( + env.service_whitelist.iter().any(|s| s.name == "sample-app"), + "sample-app service not found in config.toml's service_whitelist" + ); + + let sample_app_template_path = workspace_root.join("k8s/templates/sample-app"); + assert!(sample_app_template_path.join("deployment.yaml").exists(), "sample-app deployment.yaml missing"); + assert!(sample_app_template_path.join("service.yaml").exists(), "sample-app service.yaml missing"); + assert!(sample_app_template_path.join("configmap.yaml").exists(), "sample-app configmap.yaml missing"); + + std::env::set_current_dir(&original_cwd).expect("Failed to restore CWD"); + cleanup_test_workspace(); +} + +#[tokio::test] +async fn test_add_service_creates_service_files_and_updates_config() { + setup_test_workspace(); + let workspace_root = get_workspace_path(); + let original_cwd = std::env::current_dir().unwrap(); + std::env::set_current_dir(&workspace_root).expect("Failed to set CWD to workspace root"); + + // 1. Initialize a "develop" environment first + let init_args_develop = InitArgs { + name: "develop".to_string(), // Environment name add_service expects + config_template_path: None, + default_registry: None, + provider: Some(Provider::Local), + infra_template_path: None, + region: None, + }; + + if let Err(e) = handle_command(Commands::Init(init_args_develop), &workspace_root).await { + std::env::set_current_dir(&original_cwd).expect("Failed to restore CWD"); + panic!("test_add_service setup (init) failed: {:?}", e); + } + + // 2. Add the new service + let add_service_args = AddServiceArgs { + service_name: "new-service".to_string(), + app_type: "web-app".to_string(), + }; + + if let Err(e) = handle_command(Commands::AddService(add_service_args), &workspace_root).await { + std::env::set_current_dir(&original_cwd).expect("Failed to restore CWD"); + panic!("test_add_service (add service command) failed: {:?}", e); + } + + // Assertions + let new_service_template_path = workspace_root.join("k8s/templates/new-service"); + assert!(new_service_template_path.join("deployment.yaml").exists(), "new-service deployment.yaml missing"); + assert!(new_service_template_path.join("service.yaml").exists(), "new-service service.yaml missing"); + assert!(new_service_template_path.join("configmap.yaml").exists(), "new-service configmap.yaml missing"); + + let config_path_develop = workspace_root.join("k8s/environments/develop/config.toml"); + assert!(config_path_develop.exists(), "Develop config.toml missing after add service"); + + let develop_env_name_for_load = "develop".to_string(); + let env_develop = Environment::load_from_file(&develop_env_name_for_load) // Pass the environment name as &String + .expect("Failed to load develop config.toml after adding service"); + assert!( + env_develop.service_whitelist.iter().any(|s| s.name == "new-service"), + "new-service not found in develop config.toml's service_whitelist" + ); + + std::env::set_current_dir(&original_cwd).expect("Failed to restore CWD"); + cleanup_test_workspace(); +}