The following diagram shows how Kubeform
creates a resource on a Cloud Provider (GCP, AWS, etc.).
The Resource Creation Process of Kubeform consists of the following steps:
At first, a user creates a secret with access credentials of the Cloud provider where the resource will be created.
Then, he creates a CRD of the resource that specifies the information of the Cloud Resource. The CRD also holds the credential information.
The KubeForm Controller (KFC) watches the created CRD.
Then, KFC creates .tf
files from the CRD Spec
and the provider secret.
If the .tfstate
file doesn’t exist then KFC creates the .tfstate
file from the status.output
& status.state
fields of the CRD.
Then KFC runs terraform apply
commands on the .tfstate
file and .tf
files that were created in the previous steps.
After successful execution of terraform apply
command, it creates the specified resource on the specified Cloud Provider.
Then terraform apply
command updates the tfstate
file if necessary.
If the .tfstate
file is updated, KFC also updates the status.output
& status.state
fields of the CRD.