Skip to content

Commit

Permalink
Drop "UseStateForUnknown" UUID modifier
Browse files Browse the repository at this point in the history
That doesn't work well with movements, should be investigated later post MVP.
  • Loading branch information
kklimonda-cl committed Aug 16, 2024
1 parent e170c11 commit 8bf447e
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions pkg/translate/terraform_provider/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -940,29 +940,17 @@ func createSchemaAttributeForParameter(schemaTyp schemaType, packageName string,
computed = true
}

// TODO(kklimonda): This is pretty one-off implementation to
// support uuid-style resources, but could be expanded to be more
// generic if needed.
var modifiers *modifierCtx
if schemaTyp == schemaResource && computed && param.Default == "" {
modifiers = &modifierCtx{
SchemaType: fmt.Sprintf("planmodifier.%s", pascalCase(param.Type)),
Modifiers: []string{fmt.Sprintf("%splanmodifier.UseStateForUnknown()", param.Type)},
}
}

return attributeCtx{
Package: packageName,
Name: param.Name,
SchemaType: schemaType,
ElementType: elementType,
Description: param.Description,
Required: param.Required,
Optional: !param.Required,
Sensitive: param.Sensitive,
Default: defaultValue,
Computed: computed,
PlanModifiers: modifiers,
Package: packageName,
Name: param.Name,
SchemaType: schemaType,
ElementType: elementType,
Description: param.Description,
Required: param.Required,
Optional: !param.Required,
Sensitive: param.Sensitive,
Default: defaultValue,
Computed: computed,
}
}

Expand Down

0 comments on commit 8bf447e

Please sign in to comment.