示例#1
0
        public void Execute()
        {
            if (!CheckFile.CurrentFolderIsEqualTo("terraform", currentDirectory))
            {
                Cli.PrintLine("Error: You must be in a Terraform project folder root when executing this command.", ConsoleColor.Red);
                return;
            }

            Cli.PrintLine("Please enter the following information.");
            varInfo.varName  = GetVariableName();
            varInfo.varType  = GetVariableType();
            varInfo.isEnvVar = GetIsEnvVariable();
            if (varInfo.isEnvVar)
            {
                varInfo.DevValue  = GetVariableValue("Dev");
                varInfo.QaValue   = GetVariableValue("QA");
                varInfo.QtsValue  = GetVariableValue("QTS");
                varInfo.ProdValue = GetVariableValue("Production");
            }
            else
            {
                varInfo.GlobalValue = GetVariableValue("Global");
            }

            var varLists        = collectData.PopulateVarLists(currentDirectory);
            var variableControl = new VariableControl(currentDirectory);

            variableControl.UpsertVariable(varInfo, varLists);
        }