Skip to content

Hello, World! Environment

Make sure you've completed configuring AWS Credentials and onboarded a team before starting this walkthrough.

  1. Clone the team repo (zl-[team-name]-config) you created in onboarding a team
  2. Create a hello-world directory in the cloned repo
    cd zl-[team-name]-config
    mkdir hello-world
    cd hello-world
    
  3. Run the below bash script using terminal and enter Company, Team and Environment Names when asked.
    bash <(curl -s https://docs.zlifecycle.com/scripts/getting_started.sh)
    
  4. It will create the following hello-world.yaml:

    Click to expand!
    apiVersion: stable.compuzest.com/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"
    

  5. Commit the changes and push to Github

  6. Go to Environments page on zLifecycle UI
    • After a few minutes you should see your new environment
    • It will provision the images s3 bucket first, then videos s3 bucket
  7. Once it starts provisioning, click on the images component
  8. You should see the provision plan in the right panel
  9. Once the plan finishes you need to approve the changes by clicking Approve below the terraform plan (as shown in the image below)
  10. 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.compuzest.com/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 zLifecycle UI