Deploy and Apply the Terraform Stack

In this step, you deploy the Terraform stack either from the Oracle Marketplace or from its GitHub repository and then apply it to the desired environment.

Deploy the Terraform Stack

To start the scenario, you first need to deploy the Terraform stack. You can do so either from the Marketplace apps or from GitHub.

Deploy the Stack from Marketplace Apps

To deploy the Terraform stack from the Marketplace apps, use this procedure:

  1. Log in to Oracle Cloud.
  2. From the hamburger menu, select Marketplace then Marketplace (again) to view all available apps.
  3. Enter search keywords Logging Analytics to find the Autonomous Transaction Processing (ATP) Database Audit Logs Monitoring app.
  4. Select Stack Version then Compartment.
  5. Review the Oracle standard Terms and Restrictions and then check I have reviewed and accept.
  6. Click Launch Stack.
  7. Finally, follow the steps outlined in "Applying Stack by using the Resource Manager", below.

Deploy the Stack from Github

From GitHub, you can either do a quick deploy or deploy by using source code.

Perform a Quick Deploy

To deploy the stack quickly from GitHub, use this procedure.

  1. Go to the GitHub repository at https://github.com/oracle-quickstart/oci-management-agent.
  2. Click Deploy to Oracle Cloud in the README.md section of the page.
  3. Check I have reviewed and accept the Oracle Terms of Use and then Next.
  4. Finally, follow the steps in "Apply the Terraform Stack", below.
Deploy by Using Source Code

Use this procedure to deploy the stack from GitHub by using source code.

  1. Clone the Git repository by entering the following:
    git clone https://github.com/oracle-quickstart/oci-management-agent 
  2. Browse to the Terraform scripts directory:
    cd OciMarketplaceApps/ManagementAgent 
  3. From the hamburger menu, navigate to Developer Services then Resource Manager.
  4. On the left side of the Resource Manager, click Stacks.
  5. Click Create Stack to begin stack creation.
  6. Choose My Configuration as the origin of the Terraform configuration.
  7. Choose Folder as the Terraform configuration source.
  8. Drag and drop the folder contents in the assigned area.
  9. Finally, follow the steps in "Applying the Terraform Stack", below.

Apply the Terraform Stack

Applying the stack creates the compute instance, enables the Management Agent, installs plugins, creates entity associations, and starts capturing logs.

Configure Stack Information

To configure stack information, use this procedure.

  1. Confirm the Stack Information is correctly displayed.
  2. In Name, enter a unique stack deployment identifier.
  3. Optionally, you can add a description that accurately describes this stack deployment.
  4. Open Create in compartment and select a compartment.
  5. Optionally specify any namespace tags to organize and track any resources.
  6. Click Next to advance to the Configure Variables screen.

Configure Variables

Next, you need to configure variables by specifying the Autonomous Database for Transaction Processing details, then Compute instance details, and finally setting the Management Agent IAM policies.

Enter the Autonomous Database for Transaction Processing Details

To enter the Autonomous Database for Transaction Processing details, use this procedure.

  1. From Select ATP Compartment, select the appropriate ATP compartment.
  2. From Select the ATP database to monitor, choose the appropriate database.
  3. Enter your ATP username in ATP Username.
  4. Open Select Vault Compartment, and locate the compartment where the Vault Secret resides
  5. From Vault Secret, select the appropriate secret.
  6. Open Database Service Name and select the appropriate service name from the drop-down list.
  7. Populate Logging Analytics Log Group OCID.
Enter Compute Instance Details

To enter the compute instance details, use this procedure.

  1. Enter a unique Instance name to identify the compute instance.
  2. Open the Availability domain dropdown and select a domain.
  3. Open Instance shape and select a shape compatible with OEL7
  4. Select existing VCN from the dropdown list (refer to "Meet the Prerequisites for Implementing this Use Case", above for details).
  5. Select the existing Subnet from the dropdown (refer to "Meet the Prerequisites for Implementing this Use Case", above for details).
  6. Provide an SSH public key so you can access the compute instance.
Review the Management Agent IAM Policies

The stack is configured to always create the default policies. If the necessary policies already exist, uncheck Setup default policies (see "Review Required Policies", for details). Click Next to advance to the Review screen.

Review Entries

Now, review all information entered in the previous screens. Leave Run Apply unchecked at this time and click Create to finish creating the Stack

Apply the Stack

Now, apply the stack. This is a three-step process in which you'll validate your entries, then actually apply the stack, and, finally, destroy any service components created in the apply phase so you can revert any changes if you need to reapply the stack.

Plan the Operation

Run the planning phase as a validation step to ensure there are no issues when applying the stack. You should run the plan and verify the logs before applying the stack.

To plan application and verify the stack validity, use this procedure.
  1. Click Plan to create the Plan job.
  2. Provide a name to uniquely identify the Plan job.
  3. Click Plan to run the plan job.
  4. Review the Logs section on the same screen to ensure no problems were identified.
  5. Select Stack Details from the breadcrumb menu.
  6. Verify in the Jobs section that the plan state reads Succeeded.
Apply the Stack

Apply the stack to create the compute instance, enable the Management Agent, install plugins, create entity associations, and start capturing logs.

To apply the stack, use this procedure.
  1. Press Apply to begin creating the Apply job
  2. Enter a name that uniquely identifies the Apply job.
  3. Keep Apply Job Plan Resolution to automatically approve the apply job.
  4. Click Apply to execute the apply job.
  5. Review the Logs section on the same screen to ensure no problems were identified.
  6. Verify in the Job Information section the apply job state reads Succeeded.
  7. Under Resources, click Outputs to see the execution output information.
  8. Click the Application Information tab to access links to the newly created resources.
Destroy Service Components

You will typically destroy service components when you want to revert failed changes and clean up the environment before reapplying the stack.

Note:

Destroy does not delete Logging Analytics Entity and Management Agent from UI. To delete these resources, find the OCID in the output section of a stack job, search in the RQS section of the console, and go to the corresponding resource page. To delete the Logging Analytics entity, first remove the associated sources and then delete the entity.
To destroy the service components, use this procedure.
  1. On the Stack Details page, click Destroy to destroy resources created by the Apply job earlier earlier in this process.
  2. Enter a name that uniquely identifies the Destroy job.
  3. Click Destroy to execute the destroy job.
  4. Review the information in the Logs section to ensure all resources were destroyed.
  5. In the Job Information section, verify that the destroy job state reads Succeeded.