MCPcopy Index your code
hub / github.com/coder/coder / echoResponsesWithParameters

Function echoResponsesWithParameters

site/e2e/helpers.ts:928–1010  ·  view source on GitHub ↗
(
	richParameters: RichParameter[],
)

Source from the content-addressed store, hash-verified

926};
927
928export const echoResponsesWithParameters = (
929 richParameters: RichParameter[],
930): EchoProvisionerResponses => {
931 let tf = `terraform {
932 required_providers {
933 coder = {
934 source = "coder/coder"
935 }
936 }
937}
938`;
939
940 for (const parameter of richParameters) {
941 let options = "";
942 if (parameter.options) {
943 for (const option of parameter.options) {
944 options += `
945 option {
946 name = ${JSON.stringify(option.name)}
947 description = ${JSON.stringify(option.description)}
948 value = ${JSON.stringify(option.value)}
949 icon = ${JSON.stringify(option.icon)}
950 }
951`;
952 }
953 }
954
955 tf += `
956data "coder_parameter" "${parameter.name}" {
957 type = ${JSON.stringify(parameter.type)}
958 name = ${JSON.stringify(parameter.displayName)}
959 icon = ${JSON.stringify(parameter.icon)}
960 description = ${JSON.stringify(parameter.description)}
961 mutable = ${JSON.stringify(parameter.mutable)}`;
962
963 if (!parameter.required) {
964 tf += `
965 default = ${JSON.stringify(parameter.defaultValue)}`;
966 }
967
968 tf += `
969 order = ${JSON.stringify(parameter.order)}
970 ephemeral = ${JSON.stringify(parameter.ephemeral)}
971${options}}
972`;
973 }
974
975 return {
976 parse: [
977 {
978 parse: {},
979 },
980 ],
981 init: [
982 {
983 init: {},
984 },
985 ],

Calls

no outgoing calls

Tested by

no test coverage detected