What is tfy apply?

tfy apply is a CLI command that lets you create or update resources, such as deployments, workspaces, clusters, and provider accounts, by applying a manifest file.

A manifest is a YAML file that describes the resource you want to create or update.

Note: If you haven’t set up the CLI yet, see the CLI setup guide.

Example: Deploying an OpenAI Provider Account

Here’s a sample manifest for creating an OpenAI provider account.

name: openai-account-cli
type: provider-account/openai
collaborators:
  - subject: user:gowtham.v@truefoundry.com
    role_id: provider-account-manager
  - subject: team:everyone
    role_id: provider-account-access
auth_data:
  api_key: tfy-secret://truefoundry:openai-group:API_KEY
  type: api-key
integrations:
  - type: integration/model/openai
    name: gpt-4
    model_id: gpt-4
    model_types:
      - chat
    cost:
      value:
        input: 0.03
        output: 0.06
      metric: per_1000_tokens
  - type: integration/model/openai
    name: gpt-4o
    model_id: gpt-4o
    model_types:
      - chat
    cost:
      value:
        input: 0.0025
        output: 0.01
      metric: per_1000_tokens

What is Dry Run?

The --dry-run flag simulates the apply process without making any changes. This is useful to validate your manifest and see what would happen if you actually applied it.

What is Show Diff?

The --show-diff flag, when used with --dry-run, displays the differences between your manifest and the currently deployed resources. This helps you review what changes will be made before applying them.

Previewing Changes Before Applying

To see what changes will be made without actually applying them, you can use the following command:

tfy apply -f <your-manifest-file>.yaml --dry-run --show-diff

This will show you a diff of what will change, without updating anything.

Diff output for dry run

Applying the changes

To apply the changes in your manifest, run:

tfy apply -f <your-manifest-file>.yaml

This will actually create or update the resource as described in your YAML file.