INNER CODE UNIT · TypeScript
generateTerraformToPrimitive
jianyuan/terraform-provider-sentry · internal/providergen/index.ts:112
function generateTerraformToPrimitive({
attribute,
srcVar,
}: {
attribute: Attribute;
srcVar: string;
}) {
const srcVarName = `${srcVar}.${camelize(attribute.name)}`;
return match(attribute)
.with({ type: "string" }, () => `${srcVarName}.ValueString()`)
.with({ type: "int64" }, () => `${srcVarName}.ValueInt64()`)
.with({ type: "float64" }, () => `${srcVarName}.ValueFloat64()`)
.with({ type: "bool" }, () => `${srcVarName}.ValueBool()`)
.exhaustive();
}
function generatePrimitiveToTerraform({
name,