-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
Signed-off-by: Muvaffak Onus <me@muvaf.com>
… or given by the user Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
since that prevents multiple crds from being generated at once Signed-off-by: Muvaffak Onus <me@muvaf.com>
dcc8bed
to
35ee0e8
Compare
Signed-off-by: Muvaffak Onus <me@muvaf.com>
…remove doc file since its content needs to be in zz_types anyway. Signed-off-by: Muvaffak Onus <me@muvaf.com>
… cases Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Note that I had to put every CRD in its own package because the types originally don't have a name in the schema (they are just maps with some fields) and we produce a name for them like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, added a couple of comments which are mostly nits.
|
||
obsName := types.NewTypeName(token.NoPos, g.Package, obsTypeName, nil) | ||
obsType = types.NewNamed(obsName, types.NewStruct(obsFields, obsTags), nil) | ||
g.genTypes[obsType.Obj().Name()] = obsType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g.genTypes[obsType.Obj().Name()] = obsType | |
g.genTypes[obsTypeName] = obsType |
var paramType, obsType *types.Named | ||
paramName := types.NewTypeName(token.NoPos, g.Package, paramTypeName, nil) | ||
paramType = types.NewNamed(paramName, types.NewStruct(paramFields, paramTags), nil) | ||
g.genTypes[paramType.Obj().Name()] = paramType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g.genTypes[paramType.Obj().Name()] = paramType | |
g.genTypes[paramTypeName] = paramType |
pkg/types/builder.go
Outdated
switch sch.Type { | ||
case schema.TypeMap: | ||
return types.NewMap(types.Universe.Lookup("string").Type(), elemType), nil | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we convert both schema.TypeList
and schema.TypeSet
to slice on our side.
I am just wondering whether this would cause any issues like expecting ordered items and causing diffs because of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say I'm 100% sure but I believe these two types correspond to same thing (array) but they are accounted for during a diff operation. My hunch is that the separation is important for logic below terraform
cli but it's worth testing after we get all PRs to end-to-end working state.
Signed-off-by: Muvaffak Onus <me@muvaf.com>
Signed-off-by: Muvaffak Onus <me@muvaf.com>
We are able to generate any CRD from given Terraform resource. An example usage of these utilities are in crossplane-contrib/provider-jet-aws#3 . There are missing pieces but this will serve as a starting point.
Note that I have used some utilities from https://github.com/muvaf/typewriter . If we don't want to depend on that repo, we can reimplement those functionalities in the next iteration.