-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add kibana_saved_object resource #948
base: main
Are you sure you want to change the base?
Conversation
}, | ||
"object": schema.StringAttribute{ | ||
Description: "Kibana object to import in JSON format", | ||
Required: true, |
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.
Required: true, | |
Required: true, | |
CustomType: jsontypes.NormalizedType{}, |
The index resource has an example of using this. It means simply restructuring the JSON won't be seen as a diff.
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.
Nice, thanks for pointing that out
return | ||
} | ||
|
||
result, err := kibanaClient.KibanaSavedObject.Import([]byte(model.Imported.ValueString()), false, model.SpaceID.ValueString()) |
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.
result, err := kibanaClient.KibanaSavedObject.Import([]byte(model.Imported.ValueString()), false, model.SpaceID.ValueString()) | |
result, err := kibanaClient.KibanaSavedObject.Import([]byte(model.Imported.ValueString()), true, model.SpaceID.ValueString()) |
Given the use case here, I wonder if we should just always overwrite existing objects. It would simplify the workflow for bringing existing objects into TF, especially in a resource where a proper import
handler is kind of tricky given the API constraints.
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 wondered about that and initially had overwrite set to true
. I agree it would simplify importing resources into TF to have it set to true
.
This PR implements proper support for managing a Kibana saved object.
Unlike existing resource
kibana_import_saved_objects
, this new resource can only manage one single saved object but it keeps track of the changes, if the resource is changed in the Terraform code or in Kibana, the TF plan will show the difference. It also supports removing the saved object.Providing support for all CRUD operations is required to expose this resource in a Crossplane provider.
This PR has been tested both with Terraform and with a Crossplane provider that relies on this code.