-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created ACI converter tool #1263
Conversation
@@ -488,7 +488,7 @@ func setFvEpIpTagId(ctx context.Context, data *FvEpIpTagResourceModel) { | |||
data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) | |||
} | |||
|
|||
func getFvEpIpTagTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvEpIpTagResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvEpIpTagResourceModel) []map[string]interface{} { | |||
func GetFvEpIpTagTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvEpIpTagResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvEpIpTagResourceModel) []map[string]interface{} { |
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.
If these need to be exposed as global functions we should change the generator logic. I see a few options.
- We could make them public by capitalising the functions.
- We can create a separate package for public functions which we expose and then import in the current codebase and any support tools.
current_draft.go
Outdated
jsonFile, err := runTerraformCommands() | ||
if err != nil { | ||
log.Fatalf("Error running Terraform commands: %v", err) | ||
} |
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.
Is this done always? I thought this would be an offline tool first which does translation only of generated plan file / state? Should we have a file input into this tool?
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.
This is done to automate processes for testing on my end, which I use Terraform commands for. I will change this once testing is complete.
conversion/aci_converter.go
Outdated
log.Fatalf("Error parsing input file: %v", err) | ||
} | ||
|
||
itemList := processResources(terraformPlan) |
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 would probably rename the variable and the function to clarify a bit better what the function is doing and returning
Type string `json:"type"` | ||
Change struct { | ||
Actions []string `json:"actions"` | ||
Before map[string]interface{} `json:"before"` |
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.
Are we interested in the before to generate a plan?
Address string `json:"address"` | ||
Type string `json:"type"` | ||
Change struct { | ||
Actions []string `json:"actions"` |
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.
Are we interested in the actions or just if something is deleted?
conversion/aci_converter.go
Outdated
} | ||
|
||
type ResourceChange struct { | ||
Address string `json:"address"` |
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.
what do we use the address for?
|
||
type Resource struct { | ||
Type string `json:"type"` | ||
Name string `json:"name"` |
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.
What do we use the Name for in the resource?
conversion/aci_converter.go
Outdated
return item | ||
} | ||
|
||
func createChildrenFromAttributes(attributes map[string]interface{}) []map[string]Item { |
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.
why are these children hardcoded?
No description provided.