Reputation: 6999
The kops create cluster
command line cannot specify everything that is available in the API (eg. related to spot instances), so I need to edit the generated yaml. I would like to then generate (eg. --target=terraform
) terraform files from the edited yaml, but I can't find a way to do that. I would like to run kops create -f my.yaml --target=terraform
but the target argument is not supported for that. Is there a straightforward way to accomplish this?
The --set
flag on the create cluster command doesn't seem to work because I want to set something on the instance groups. I tried several things, but always get the error that X is not a field in *Cluster
.
I did find that if I create the cluster (in kops, though it doesn't have to be in the cloud), run kops edit ... --set ...
, then I can run kops update cluster ... --target terraform
and that will work. But that's a bit slow and frustrating.
Upvotes: 0
Views: 38
Reputation: 6999
I realized that even if you run kops create cluster ... --target terraform
, there's no way around it creating the state in kops anyway. So the process I mentioned in the question seems to be the correct answer.
So, if you want to set things on the instance groups before generating terraform, you can do (for a single zone):
kops create cluster \
--zones ${ZONE} \
# ...
kops edit ig control-plane-${ZONE} \
# ...
--set "spec.some.field=val1"
--set "spec.some.other.field=val2"
kops edit ig nodes-${ZONE} \
# ...
--set "spec.some.field=val1"
--set "spec.some.other.field=val2"
kops update cluster \
# ...
--target=terraform
where you can find the field names in the kops API docs.
Upvotes: 0