Skip to content
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

Timestamp changes cause plan output to force change #22

Open
andyt338 opened this issue Sep 30, 2021 · 4 comments
Open

Timestamp changes cause plan output to force change #22

andyt338 opened this issue Sep 30, 2021 · 4 comments

Comments

@andyt338
Copy link

After creating a Kibana object, the rule is successfully created. However, when you re-run terraform plan, it detects a change every time, because /api/saved_objects/_import automatically updates timestamps (such as updated_at).

@eloo
Copy link

eloo commented Oct 7, 2022

I see the same using a Kibana/ES 8 cluster

it looks like the following attributes are going to change everytime, so they should be excluded

    "sort": [
        1665127028281,
        487
    ],
    "updated_at": "2022-10-07T07:17:08.281Z",
    "version": "WzE0MzcsNF0="

edit:
i guess we would need to filter the mentioned attributes out here:
https://github.com/disaster37/terraform-provider-kibana/blob/8.x/kb/resource_kibana_object.go#L121

@disaster37
Copy link
Owner

Hum, it's strange, because of version and updated_at are removed before to compare expected and actual object:

config.Remove("updated_at", -1)

@disaster37
Copy link
Owner

Maybee you can try with verison v8.5.1

@eloo
Copy link

eloo commented Nov 17, 2022

@disaster37 thanks for the update..
just tested it and it seems that the changes of

coreMigrationVersion
migrationVersion
updated_at
version

is ignored as expected but is shown in the change log if there is another change..
so its a bit confusion but working if you "fix" the other changes..

maybe it would be cool to document this and also add an example like this

resource "kibana_object" "test3" {
  name           = "[ALL] LogLevels.json"
  data           = jsonencode(jsondecode("${file("./fixtures/saved-objects/${terraform.workspace}/visualization/[ALL] LogLevels.json")}"))
  deep_reference = false
    export_objects {
    id   = jsondecode("${file("./fixtures/saved-objects/${terraform.workspace}/visualization/[ALL] LogLevels.json")}").id
    type = "visualization"
  }
}
{
  "attributes": {
    "description": "",
    "kibanaSavedObjectMeta": {
      "searchSourceJSON": "{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"
    },
    "title": "[ALL] LogLevels",
    "uiStateJSON": "{\"vis\":{\"colors\":{\"ERROR\":\"#EA6460\",\"INFO\":\"#1F78C1\",\"WARN\":\"#F2C96D\"}}}",
    "version": 1,
    "visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"field\":\"service.keyword\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"size\":9999},\"schema\":\"segment\",\"type\":\"terms\"},{\"enabled\":true,\"id\":\"3\",\"params\":{\"field\":\"level_name.keyword\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"size\":5},\"schema\":\"group\",\"type\":\"terms\"},{\"enabled\":false,\"id\":\"4\",\"params\":{\"field\":\"space.keyword\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"size\":999},\"schema\":\"group\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"labels\":{\"filter\":true,\"show\":true,\"truncate\":100},\"position\":\"bottom\",\"scale\":{\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{},\"type\":\"category\"}],\"detailedTooltip\":true,\"dimensions\":{\"series\":[{\"accessor\":1,\"aggType\":\"terms\",\"format\":{\"id\":\"terms\",\"params\":{\"id\":\"string\",\"missingBucketLabel\":\"Missing\",\"otherBucketLabel\":\"Other\"}},\"params\":{}},{\"accessor\":2,\"aggType\":\"terms\",\"format\":{\"id\":\"terms\",\"params\":{\"id\":\"string\",\"missingBucketLabel\":\"Missing\",\"otherBucketLabel\":\"Other\"}},\"params\":{}}],\"x\":{\"accessor\":0,\"aggType\":\"terms\",\"format\":{\"id\":\"terms\",\"params\":{\"id\":\"string\",\"missingBucketLabel\":\"Missing\",\"otherBucketLabel\":\"Other\"}},\"params\":{}},\"y\":[{\"accessor\":3,\"aggType\":\"count\",\"format\":{\"id\":\"number\"},\"params\":{}}]},\"grid\":{\"categoryLines\":false},\"isVislibVis\":true,\"labels\":{\"show\":false},\"legendPosition\":\"right\",\"palette\":{\"name\":\"kibana_palette\",\"type\":\"palette\"},\"radiusRatio\":0,\"seriesParams\":[{\"circlesRadius\":1,\"data\":{\"id\":\"1\",\"label\":\"Count\"},\"drawLinesBetweenPoints\":true,\"mode\":\"stacked\",\"show\":\"true\",\"showCircles\":true,\"type\":\"histogram\",\"valueAxis\":\"ValueAxis-1\"}],\"thresholdLine\":{\"color\":\"#34130C\",\"show\":false,\"style\":\"full\",\"value\":10,\"width\":1},\"times\":[],\"type\":\"histogram\",\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"labels\":{\"filter\":false,\"rotate\":0,\"show\":true,\"truncate\":100},\"name\":\"LeftAxis-1\",\"position\":\"left\",\"scale\":{\"mode\":\"normal\",\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"Count\"},\"type\":\"value\"}]},\"title\":\"[ALL] LogLevels\",\"type\":\"histogram\"}"
  },
  "id": "ad3c4490-0d34-11ea-a428-6d8026ff3a31",
  "references": [
    {
      "id": "myindex-*.gelf",
      "name": "kibanaSavedObjectMeta.searchSourceJSON.index",
      "type": "index-pattern"
    }
  ],
  "type": "visualization"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants