-
Notifications
You must be signed in to change notification settings - Fork 38
Alternative ways to store terraform state #12
Comments
I believe constructing the state from CR would make it easier to understand the general flow since it'll be very similar to existing providers and also it's one less computed thing that we have to persist (on top of external-name).
In the beginning of the reconciliation, we can print the state as we know it and execute
Here is the documentation that explains what these fields mean.
I believe we can use UUID of the CR for lineage and serial can just be an arbitrary number because from what I understand, it's read in the beginning and $ echo "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" | base64 -d
{"schema_version":"1"} I think |
I just tested removing everything except |
This could be related just in case we end up needing to store the whole state for whatever reason: hashicorp/terraform#28603 |
In the initial implementation, we are planning to store terraform states as annotations for the managed resource.
ETCD (i.e. annotation) will be authoritative in terms of the state and we avoid making any changes/edits on it except stripping out sensitive attributes. This is the most conservative approach in terms of using terraform just like as an end-user.
However, we want to investigate whether we can safely (re)build the state information from the spec, status, and kind information of the resource and completely remove the annotation.
To better describe the problem, see the following
tfstate
example:resources[0].instances[0].attributes
field, is a combination ofspec.forProvider
status.atProvider
external_name
annotation (id
here)resources[0].instances[0].sensitive_attributes
field would be available in the connection secret (if required during apply)resources[0].type
,resources[0].name
andresources[0].provider
would also be available during reconciliation.Two caveats here:
spec.forProvider
contains the desired state, not the last applied state which would be different that whattfstate
typically contains.lineage
,serial
andresources[0].instances[0].private
exactly the same as the original one which would require to persist them as well.The text was updated successfully, but these errors were encountered: