This example will deploy an instance of LogDNA and a classic infrastructure VSI. The VSI will then be configured to ship logs to the newly deployed LogDNA instance.
This code is written to work with Terraform 0.13 and above. If you would like to work with multiple versions of Terraform on the same machine take a look at tfswitch.
Step 1: Clone repo
$ git clone https://github.com/greyhoundforty/IBMCloud-Terraform-Examples.git
$ cd ClassicVSILogDNA
Step 2: Update example .tfvars
file
You will need to update the terraform.tfvars.example
and then rename it so that Terraform picks up the variables. The file has comments for each item that you need to provide. When done updating the file rename it:
$ cp terraform.tfvars.example terraform.tfvars
Step 3: Initialize Terraform
The version.tf
file will automatically download the most up to date version of the IBM Cloud Terraform Provider when you initialize the directory.
$ terraform init
Step 4: Create Terraform plan
If the terraform init
command completed without error you are now ready to create a plan for your deployment.
$ terraform plan -out default.tfplan
Step 5: Apply generated plan
If our plan generated successfully we can now deploy our resources using the apply
command.
$ terraform apply default.tfplan
If your account has been set up to use virtual routing and forwarding (VRF) you can enable service endpoints for your infrastructure account. When your account is enabled for VRF and Service Endpoints, you can connect to IBM Log Analysis with LogDNA by using a private IP that is accessible only through the IBM Cloud private network.
If you would like to use the private LogDNA endpoints you will need to update the instance/install.sh
with the following changes:
api.private.${region}.logging.cloud.ibm.com
logs.private.${region}.logging.cloud.ibm.com