alt-dima / tofugu

Infrastructure layers configuration orchestrator for OpenTofu or Terraform
Apache License 2.0
3 stars 0 forks source link

Analytics for tofi and dimensions state (infrastructure state) #15

Open alt-dima opened 4 months ago

alt-dima commented 4 months ago

Would be nice to have a history of the tofugu executions to know, what the last state of the applied configuration by tofi and dimensions.

For example, what sha/checksum of the tofi (tf code) was applied to -d datacenter:staging1 -d account:test-account and when and by whom?

Than it will be easy to display chart/map of the infrastructure current/last state

Document fields

alt-dima commented 4 months ago

Info stored in ToasterDB like

{
  "_id": { "$oid": "66367db93509ca433fdcfb06" },
  "orgname": "demo-org",
  "workspace": "master",
  "tofiname": "vpc",
  "cmdtoexec": "tofu",
  "cmdargs": [
    "-backend-config=bucket=default-tfstates",
    "-backend-config=key=org_demo-org/account_test-account/datacenter_staging1/vpc.tfstate",
    "-backend-config=region=us-east-2"
  ],
  "cmdmainarg": "init",
  "exitcode": { "$numberInt": "1" },
  "dimensions": {
    "account": "test-account",
    "datacenter": "staging1"
  },
  "accountid": "662cab7c5e226819838b01fa",
  "datecreated": {
    "$date": { "$numberLong": "1714846798515" }
  }
}
alt-dima commented 4 months ago

Will think about it more, not merging now. Maybe it should be disabled by default and enabled via tofugu config, or somehow else (in account in ToasterDB?).