Step 3: Initialize and Preview the Terraform Plan

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

This topic describes how to initialize and preview Terraform Plan.

The results should match what you are planning to create. If not, adjust the configuration and run terraform plan.

  1. Run terraform init to initialize your configuration.

    This examines your configuration and downloads any required providers.

    jfrog ~/Desktop/WorkersTF  $ terraform init
    Initializing the backend...
    Initializing provider plugins...
    - Finding jfrog/artifactory versions matching "12.7.1"...
    - Finding jfrog/platform versions matching "2.2.0"...
    - Installing jfrog/platform v2.2.0...
    - Installed jfrog/platform v2.2.0 (signed by a HashiCorp partner, key ID 2FA4D2A520237FA7)
    - Installing jfrog/artifactory v12.7.1...
    - Installed jfrog/artifactory v12.7.1 (signed by a HashiCorp partner, key ID 2FA4D2A520237FA7)
    Partner and community providers are signed by their developers.
    If you'd like to know more about provider signing, you can read about it here:
    https://www.terraform.io/docs/cli/plugins/signing.html
    Terraform has created a lock file .terraform.lock.hcl to record the provider
    selections it made above. Include this file in your version control repository
    so that Terraform can guarantee to make the same selections by default when
    you run "terraform init" in the future.
    
    Terraform has been successfully initialized!
    
    You may now begin working with Terraform. Try running "terraform plan" to see
    any changes that are required for your infrastructure. All Terraform commands
    should now work.
    
    If you ever set or change modules or backend configuration for Terraform,
    rerun this command to reinitialize your working directory. If you forget, other
    commands will detect it and remind you to do so if necessary.
  2. Run terraform plan to preview the changes.

    jfrog ~/Desktop/WorkersTF  $ terraform plan
    
    Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
      + create
    
    Terraform will perform the following actions:
    
      # artifactory_local_generic_repository.my_generic_local1 will be created
      + resource "artifactory_local_generic_repository" "my_generic_local1" {
          + archive_browsing_enabled = false
          + blacked_out              = false
          + cdn_redirect             = false
          + download_direct          = false
          + id                       = (known after apply)
          + includes_pattern         = "**/*"
          + key                      = "my-generic-local1"
          + priority_resolution      = false
          + project_environments     = (known after apply)
          + repo_layout_ref          = "simple-default"
          + xray_index               = false
            # (4 unchanged attributes hidden)
        }
    
      # platform_workers_service.my_workers_service will be created
      + resource "platform_workers_service" "my_workers_service" {
          + action          = "BEFORE_DOWNLOAD"
          + description     = "My workers service"
          + enabled         = true
          + filter_criteria = {
              + artifact_filter_criteria = {
                  + repo_keys = [
                      + "my-generic-local1",
                    ]
                }
            }
          + key             = "my-workers-service"
          + secrets         = [
              + {
                  + key   = "my-secret-key-1"
                  + value = "my-secret-value-1"
                },
              + {
                  + key   = "my-secret-key-2"
                  + value = "my-secret-value-2"
                },
            ]
          + source_code     = <<-EOT
                export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => {
                  console.log(await context.clients.platformHttp.get('/artifactory/api/system/ping'));
                  return { status: 'DOWNLOAD_PROCEED', message: 'proceed' };
                }
            EOT
        }
    
    Plan: 2 to add, 0 to change, 0 to destroy.