Deploy the Terraform Stack

You can deploy the Terraform stack one of three ways: by using the Oracle Resource Manager, by using the command-line interface (CLI), or from Oracle Cloud Marketplace.

Deploy the Stack by Using Oracle Resource Manager

To deploy the stack by using the Oracle Resource Manager, use this procedure.

  1. Click Deploy to Oracle Cloud
    If you aren't already signed in, when prompted, enter the tenancy and user credentials.
  2. Review and accept the terms and conditions.
  3. Select the region where you want to deploy the stack.
  4. Follow the on-screen prompts and instructions to create the stack.
  5. After creating the stack, click Terraform Actions, and select Plan.
  6. Wait until the job runs and then review the plan. To make any changes, return to the Stack Details page, click Edit Stack, and make the required changes. Then, run the Plan action again.
  7. If no further changes are necessary, return to the Stack Details page, click Terraform Actions, and select Apply.

Deploy the Stack By Using the Terraform CLI

Deploying the stack by using the Terraform CLI requires that you clone the module, meet a set of prerequisites, set up and configure the terraform.tfvars file, and create the Terraform resources. Once deployed, you can test the stack and, when it's no longer needed, destroy the environment,

  1. First, you'll need a local copy of this repository. To do so, enter the following commands:
    git clone https://github.com/oracle-quickstart/oci-observability-and-management/tree/master/oci-idcs-monitoring
    cd idcs-auditlog-collector/terraform
    ls
  2. Now, do some pre-deployment setup inside your machine to enable Docker and Fn Project. Enter these commands:
    sudo su -
    yum update
    yum install yum-utils
    yum-config-manager --enable *addons
    yum install docker-engine
    groupadd docker
    service docker restart
    usermod -a -G docker opc
    chmod 666 /var/run/docker.sock
    exit
    curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
    exit
  3. Now, create and configure the terraform.tfvars file. Use this procedure:
    1. Verify that you've met the prerequisites.
    2. In a file editor, create a file called terraform.tfvars and specify the following variables:
      #Authentication
      tenancy_ocid         = "tenancy_ocid"
      user_ocid            = "user_ocid"
      fingerprint          = "finger_print"
      private_key_path     = "pem_private_key_path"
       
      # Region
      region = "oci_region"
       
      # Compartment
      compartment_ocid = "compartment_ocid"
       
      # IDCS info
      idcs_url = "IDCS_URL"
      idcs_clientid = "IDCS_CLIENTID"
      idcs_cred_vault_compartment = "VAULT_COMPARTMENT-OCID"
      idcs_client_vaultsecret = "VAULT_SECRET-OCID"
       
      # Logging Analytics info
       
      log_analytics_group_id = "logging_analytics_group_ocid"
       
      # A new entity will be created 
      log_analytics_entity_name = "IDCS entity name"
       
      # OCIR
      ocir_user_name         = "ocir_user_name"
      ocir_user_password     = "ocir_user_password"
  4. Create the resources by entering the following commands:
    terraform init 
    terraform plan 
    terraform apply
  5. Now, test the stack. The function will load the logs in five minutes and you can see it in Log Analytics Log Explorer. If there is little activity in IDCS, you can log-in/log-out to generate audit logs.
  6. When you no longer need the deployment, you can run this command to destroy the resources:
    terraform destroy

    Note:

    If there is an error in deleting object storage bucket, delete the bucket manually and then run terraform destroy again.

Deploy the Stack from Oracle Cloud Marketplace

To deploy the stack from Oracle Marketplace, use this procedure:

  1. Go to Oracle Cloud Marketplace.
  2. Click Get App.
  3. Follow the on-screen prompts.