Skip to content

Hello, World! Environment

Make sure you've completed configuring AWS Credentials and onboarded a team before starting this walkthrough. 1. Create a hello-world directory in the cloned repo 1. Clone the team repo (zl-[team-name]-config) you created in onboarding a team

cd zl-[team-name]-config
mkdir hello-world
cd hello-world
1. Run the below bash script using terminal and enter Company, Team and Environment Names when asked.
bash <(curl -s https://docs.cloudknit.io/scripts/getting_started.sh)
1. It will create the following hello-world.yaml:
Click to expand!
apiVersion: stable.cloudknit.io/v1
kind: Environment
metadata:
  name: company-hello-world
  namespace: company-config
spec:
  teamName: your-team
  envName: hello-world
  components:
    - name: images
      type: terraform
      module:
        source: aws
        name: s3-bucket
      variables:
        - name: bucket
          value: "company-hello-world-images-abcde"
    - name: videos
      type: terraform
      dependsOn: [images]
      module:
        source: aws
        name: s3-bucket
      variables:
        - name: bucket
          value: "company-hello-world-videos-vwxyz"

  1. Commit the changes and push to Github
  2. Go to Environments page on CloudKnit UI
    • After a few minutes you should see your new environment
    • It will provision the images s3 bucket first, then videos s3 bucket
  3. Once it starts provisioning, click on the images component
  4. You should see the provision plan in the right panel
  5. Once the plan finishes you need to approve the changes by clicking Approve below the terraform plan (as shown in the image below)
  6. This will start provisoning the images s3 bucket (which is terraform apply)

sample-right-panel

Teardown your first Environment

After you have provisioned your first environment, let's go through the teardown exercise.

You can read more about teardown here.

  1. Add teardown: true in hello-world.yaml at the spec level. See example below:

    Click to expand!
    apiVersion: stable.cloudknit.io/v1
    kind: Environment
    metadata:
      name: zmart-hello-world
      namespace: zmart-config
    spec:
      teamName: your-team
      envName: hello-world
      teardown: true # Add this
      components:
        - name: images
          type: terraform
          module:
            source: aws
            name: s3-bucket
          variables:
            - name: bucket
              value: "zmart-hello-world-images-abcde"
        - name: videos
          type: terraform
          dependsOn: [images]
          module:
            source: aws
            name: s3-bucket
          variables:
            - name: bucket
              value: "zmart-hello-world-videos-vwxyz"
    

  2. Commit and push changes to Github

    • The teardown will start at the bottom most leaf node
  3. Approve the teardown plan when prompted
  4. Monitor the progress on CloudKnit UI