class TerraformEnterprise::CommandLine::Commands::MainCommand
Terraform Enterprise Command
Line class
Public Instance Methods
push(name)
click to toggle source
# File lib/terraform_enterprise/command_line/commands/main.rb, line 50 def push(name) name_parts = name.split('/') organization_name = name_parts[0] workspace_name = name_parts[1] workspace_params = { organization: organization_name, workspace: workspace_name } begin content = tarball(options[:path]) rescue error! "could not open that file or directory" end # Look up the workspace ID workspace_response = client.workspaces.get(workspace_params) workspace_id = workspace_response&.resource&.id error! "workspace '#{organization_name}/#{workspace_name}' was not found!" unless workspace_id # Create a configuration version and get upload-url configuration_version_response = client.configuration_versions.create(workspace: workspace_id) upload_url = (configuration_version_response&.resource&.attributes || {})['upload-url'] error! "failed creationg configuration version with workspace id `#{workspace_id}`" unless upload_url upload_params = { content: content, url: upload_url } render client.configuration_versions.upload(upload_params) end
version()
click to toggle source
# File lib/terraform_enterprise/command_line/commands/main.rb, line 80 def version puts "Terraform Enterprise CLI #{TerraformEnterprise::CommandLine::VERSION}" end