Configuring Terraform

The Terraform configuration files, such as .tf files, are typically located within the executable directory or subdirectories. Therefore, executing the Terraform configuration commands in the specific directory is necessary.

To make an executable directory:

  1. Create an example.tf file in the directory containing the Terraform executable.

  2. Place the content into the example.tf file from:

    1. secrets_get.tf file: for retrieving a multiple secret.

    2. secret_create.tf file: for creating or updating a secret.

      You can find these files in the terraform-provider-tss>examples>secrets directory.

    These files are only for reference on how to fetch or create secrets. You can use the content of the files as a guide to make your actual .tf file.

  3. Update the Terraform and the terraform-provider-tss versions in the terraform block of the example.tf file according to your terraform and your terraform-provider-tss versions:

  4. Copy
    terraform {

      required_version = "1.12.1"

      required_providers {

        tss = {

          source = "DelineaXPM/tss"

          version = "3.0.0"

        }

      }

    }
  5. Create a terraform.tfvars file in the directory containing the Terraform executable.

  6. Place the variables into the file with the appropriate values corresponding to getting, creating, or updating a secret.

    You can find the list of variables in the terraform-provider-ts>vars>secrets directory.

    1. To access the Secret Server via the platform, provide the platform URL as input to tss_server_url and the platform user credentials to tss_username and tss_password.

    2. Variables for getting a secret via the Platform by ID:

    3. Copy
      tss_username = "my_platform_app_user"
      tss_password = "password"
      tss_server_url = "https://platform.delinea.app"
      tss_secret_id = ["1", "2", "3"]

    4. Variables for creating/updating a secret via the Platform:

    Copy
    tss_username = "my_platform_app_user "
    tss_password = "password"
    tss_server_url = "https://platform.delinea.app"
    tss_secret_name = "Windows Account"
    tss_secret_siteid = 1
    tss_secret_folderid = 0
    tss_secret_templateid = 6003
    fields = [
      {
        fieldname   = "Machine"
        itemvalue = "enter the hostname/ip of the machine"
      },
      {
        fieldname   = "Username"
        itemvalue = "enter my_app_user"
      },
      {
        fieldname   = "Password"
        itemvalue = "enter the password"
      },
      {
        fieldname   = "Notes"
        itemvalue = "enter additional notes for your secret"
      }
    ]

To create variables for supporting the different secret template:

  1. In the Delinea Platform, go to Settings > Administrator > Secret template. The Secret templates page opens.

  2. Replace the tss_secret_templateid value with the template ID. You can see the ID in the URL when you select any template in the Delinea Platform.

  3. Select the Fields tab.

  4. Select Add field to add a new field or select each field to edit it.

    The above example has four fields in the template, but the number of fields can vary from template to template.

After completing the configuration instructions above, the Terraform executable directory should look like this: