This topic describes how to create Terraform Plan.
Open your preferred text editor, create a new file named main.tf
, and add the following sample configuration, which includes providers for managing a local generic repository in Artifactory and a Workers Service resource using the Platform provider.
The following example configuration creates a local generic repository resource using the Artifactory Terraform provider, and then uses the Platform provider to create a Workers Service resource.
terraform { required_providers { artifactory = { source = "registry.terraform.io/jfrog/artifactory" version = "12.7.1" } platform = { source = "registry.terraform.io/jfrog/platform" version = "2.2.0" } } } provider "artifactory" { url = "<artifactory_url>" access_token = "<access_token>" } provider "platform" { url = "<platform_url>" access_token = "<access_token" } resource "artifactory_local_generic_repository" "my_generic_local1" { key = "my-generic-local1" } resource "platform_workers_service" "my_workers_service" { key = "my-workers-service" enabled = true description = "My workers service" source_code = <<EOF 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' }; } EOF action = "BEFORE_DOWNLOAD" filter_criteria = { artifact_filter_criteria = { repo_keys = [artifactory_local_generic_repository.my_generic_local1.key] } } secrets = [ { key = "my-secret-key-1" value = "my-secret-value-1" }, { key = "my-secret-key-2" value = "my-secret-value-2" } ] }