Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom HCP instance selection (#1678)
This presents a new login workflow when the editor is opened without a stored HCP session which allows the user to select from the existing instances stored in the Terraform CLI credentials file or create a new instance. This allows users to select custom HCP Terraform or Terraform Enterprise instances in addition to the official HCP Terraform site (app.terraform.io). Once an instance is selected, the normal token quickpick is presented to choose the method of retrieving the authentication token. In order to "remember" the custom instance selected by the user, the hostname is stored in the secret store when the user logs in. This ensures that the hostname is available when the user logs in again. This is necessary because the hostname is used to construct the API URL and the Web URL for a given TFE or HCP Terraform instance. This also handles sessions created before this version without a hostname to connect to. It will set the hostname to the default Terraform Cloud API URL if it is undefined. The order of hostname options in the instance quick pick shows existing host names (if any) first then an option to create a new one. This makes it easier for users to select an existing hostname if they have one, as that is most likely the more common workflow. It also adds the ability to identify TFE instances by making a call to the `/ping` endpoint. This will allow the user to see the name of the instance they are connecting to in the quickpick menu. There is still some hardcoding of 'HCP Terraform' where 'Terraform Enterprise' should be in the code that needs to be updated to be more generic, but that can be handled in a separate set of work. --------- Co-authored-by: James Pogran <jpogran@outlook.com>
- Loading branch information