{"id":25115735,"url":"https://github.com/devops-rob/target-cli","last_synced_at":"2025-08-01T20:43:27.918Z","repository":{"id":57531471,"uuid":"273040363","full_name":"devops-rob/target-cli","owner":"devops-rob","description":"A CLI tool to manage context profiles for HashiCorp tools","archived":false,"fork":false,"pushed_at":"2024-01-19T20:15:11.000Z","size":2262,"stargazers_count":32,"open_issues_count":5,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T14:56:59.521Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devops-rob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-17T17:37:51.000Z","updated_at":"2024-10-26T05:49:54.000Z","dependencies_parsed_at":"2023-09-27T03:36:41.859Z","dependency_job_id":"5d066aef-b648-4bea-9bf8-c11fb4277d4d","html_url":"https://github.com/devops-rob/target-cli","commit_stats":null,"previous_names":["target-hcl/target","target-cli/target-cli","devops-rob/target"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/devops-rob/target-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-rob%2Ftarget-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-rob%2Ftarget-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-rob%2Ftarget-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-rob%2Ftarget-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devops-rob","download_url":"https://codeload.github.com/devops-rob/target-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-rob%2Ftarget-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268294206,"owners_count":24227642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-08T02:33:51.261Z","updated_at":"2025-08-01T20:43:27.877Z","avatar_url":"https://github.com/devops-rob.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Target CLI\n\n[![goreleaser](https://github.com/devops-rob/target-cli/actions/workflows/release.yaml/badge.svg)](https://github.com/devops-rob/target-cli/actions/workflows/release.yaml)\n\nA CLI tool to manage context profiles for HashiCorp products.  This allows you to save connection and configuration details, which would otherwise be set using Environment Variables into context profiles and gives the ability to switch between different profiles as required and set default context profiles.\n\n\n### Installation\n\n**Mac / Linux via Brew**\n\n```shell\nbrew tap devops-rob/tap \u0026\u0026 \\\n  brew install target\n```\n\n**Linux Quick Install**\n\n```shell\ncurl https://raw.githubusercontent.com/devops-rob/target-cli/main/install.sh | bash\n```\n\n**Releases**\n\nBinaries can be downloaded for the releases page.\n\n[https://github.com/devops-rob/target-cli/releases](https://github.com/devops-rob/target-cli/releases)\n\n### Example use case\n\nThere are two vault clusters, one for Dev (\u003chttp://dev-vault:8200\u003e) and one for Prod (\u003chttps://prod-vault:8200\u003e).\n\nRunning Vault CLI commands locally will by default attempt to connect to \u003chttps://localhost:8200\u003e.  To connect to another cluster, you need to know and remember the connection details and set a Vault environment variable. When you want to switch to a different cluster, you again need to set the environment variable.  Target allows you to save multiple connection details into context profiles and easily switch between them as you require.\n\n### What Is a Context Profile?\n\nA context profile is a grouping of configuration parameters required to perform an action against one of the supported HashiCorp Tools. A vault example is a context profile made of an `endpoint` pointing to `https://prod-vault:8200`, a `namespace` pointing to `admin/target`, and a `token` pointing to `s.12345790asdfghjklpoi`. This would render the following commands `export VAULT_ADDR=https://prod-vault:8200; export VAULT_NAMESPACE=admin/target; export VAULT_TOKEN=s.12345790asdfghjklpoi`. This can then be used with the `eval` command to set these environment variables in the current shell session.\n### Example usage\n\n```shell\neval $(target vault select prod)\n```\n\n### Current Supported Tools\n\n- Terraform\n- Vault\n- Boundary\n- Consul\n- Nomad\n\n### Configuring Target CLI For Your Shell\n\nTarget CLI allows engineers to set default context profiles that are automatically loaded into your shell session via Environment Variables. In order for this to work, you must configure your shell's start up scripts to load in Target CLI defaults.\n\nFor example, to configure Target CLI for zsh, we need to point the CLI at our `zshrc file`. For most users, this will be located at `~/.zshrc`.\n\nTo configure Target CLI for this shell type, run the following command\n\n```shell\ntarget configure --path \"~/.zshrc\"\n```\n\nThis will write a small helper script to the file that will come into effect when a new shell session is loaded.\n\n### Terraform\n\nThis is designed to store sets of terraform variables into profiles to allow for easy switching. \n\n#### Example Use case\n\nLet's say there are three environments, dev, test, and prod. Each environment is deployed and configured with Terraform. Configuration parameters are set using Terraform variables; however, each environment should be configured with its own naming convention. \n\n- `dev` has resource names prefixed with `dev-`\n- `test` has resource names prefixed with `test-`\n- `prod` has resource names prefixed with `prod-`\n\nTo configure a set of variables for each environment, we can set up a dev context profile where the variable values are set accordingly, and do the same for test and prod context profiles. This means to deploy to a specific environment, an operator can switch context before applying their terraform code.\n\n**Create Example**\n\n```shell\ntarget terraform create dev \\\n  --var \"aws_region=eu-west1\" \\\n  --var \"vpc_name=dev-vpc\" \\\n  --var \"ec2_instance_name=dev-droid-vm\"\n```\n\nThis will create a context profile named `dev` with 3 terraform variables, `aws_region`, `vpc_name`, and `ec2_instance_name`\n\n**Update Example**\n\n```shell\ntarget terraform update example \\\n  --var \"aws_region=eu-west2\" \\\n  --var \"vpc_name=dev\" \\\n  --var \"ec2_instance_name=dev-starship-vm\"\n```\n\nThis will update the values of the `dev` context profile created in the previous step\n\n**Delete Example**\n\n```shell\ntarget terraform delete dev\n```\n\nThis will delete the context profile named `dev`\n\n### Vault, Consul, Nomad and Boundary\n\nEach of these tool sub commands work in the same way using the available flags for each tool specific argument. Below are some examples using Vault\n\n**Create Example**\n\n```shell\ntarget vault create staging \\\n  --endpoint \"https://staging-vault.target:8200\" \\\n  --cacert \"your CA cert\" \\\n  --cert \"your cert\" \\\n  --key \"your key\" \\\n  --skip-verify true \\\n  --cli-no-colour true \\\n  --client-timeout \"60s\" \\\n  --format \"json\"\n```\n\n**Update Example**\n\n```shell\ntarget vault update staging \\\n  --endpoint \"https://staging-vault.com:8200\" \\\n  --cacert \"your new CA cert\" \\\n  --cert \"your cert\" \\\n  --key \"your key\" \\\n  --skip-verify true \\\n  --format \"json\"\n```\n\n**Delete Example**\n\n```shell\ntarget vault delete staging\n```\n\n**List Example**\n\n```shell\ntarget vault list\n```\n\n### Setting Default Context Profiles\n\nSetting the default or changing the default context profile for a tool can be done with the `set-default` sub command. \n\n```shell\ntarget vault set-default staging\n```\n\nOnce a default has been set, a new shell will need to be launch in order for the changes to take effect. All new shell session swill spawn with your defaults as set.\n\n### Switching Context profiles\n\nThis can be done using the `select` sub command:\n\n```shell\ntarget vault select dev\n```\n\nThis will print all `export` commands for the selected context profile. \n\nIn order for this to take effect in the current shell session, the above command will need to be wrapped in an `eval` command:\n\n```shell\neval $(target vault select dev)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-rob%2Ftarget-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevops-rob%2Ftarget-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-rob%2Ftarget-cli/lists"}