Open1

Jsonnet と ecspresso がどっからどこまでどっちなのか

oieioioieioi
  • ecspresso でECSの設定JSONを書いていて、{{ tfstate `hoge.fuga` }}tfstate("hoge.fuga") とかなんかよく解んなくなった
  • ecspresso は JSON や Jsonnet ファイルを読み込んだ後、そのJSONに対して置換を行っているだけ。

ecspresso deploy works as below.

  • Register a new task definition from task-definition file (JSON or Jsonnet).
    • Replace {{ env `FOO` `bar` }} syntax in the JSON file with environment variable "FOO".
      • If "FOO" is not defined, replaced by "bar"
    • Replace {{ must_env `FOO` }} syntax in the JSON file wth environment variable "FOO".
      • If "FOO" is not defined, abort immediately.
  • Update service tasks by the service_definition file (JSON or Jsonnet).
  • Wait for the service to be stable.

Configuration files and task/service definition files are read by go-config which provides template functions env, must_env and json_escape.

  • だから { "some_value": "{{ tfstate `hoge.fuga` }}" } がまずJSONとしてあり、そのJSONの {{}} 部分を置換するのが ecspresso
  • このJSONを整えるまでに Jsonnet を使っていたら、それは Jsonnet として評価される。
    • { "some_value": tfstate("hoge.fuga") }tfstate は Jsonnet の方の構文だから Jsonnet として評価される。