Skip to content

Automates the BigFix execute multi action resource on VM, along with list computer and list fixlet datasources using Terraform Provider.

Notifications You must be signed in to change notification settings

GSLabDev/terraform-provider-bigfix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform BigFix Provider

This is the repository for the Terraform bigfix Provider, which one can use with Terraform to work with bigfix.

Coverage is currently limited to a one resource only ie. Multiple action group and two data sources called Computer and Fixlet

For general information about Terraform, visit the official website and the GitHub project page.

Using the Provider

The current version of this provider requires Terraform v0.12 or higher to run.

Note that you need to run terraform init to fetch the provider before deploying. Read about the provider split and other changes to TF v0.12 in the official document found here.

Full Provider Documentation

The provider is useful for creating multiple action group in bigfix for particular target computer.

Additionally you can mention custom attributes for multiple action group using xml file along with terraform configuration file.

Example

Checkout complete example here

# Configure the Bigfix Provider
provider "bigfix" {
  port = var.bigfix_port
  username = var.bigfix_username
  password = var.bigfix_password
  server = var.bigfix_server
}

# data source bigfix fixlet
data "bigfix_fixlet" "myfixlet"{
  name = var.fixlet_name
}

###########################################
# example: patch a linux machine
###########################################

# data source bigfix computer
data  "bigfix_computer" "linux_vm"{
  name = var.linux-vm-name
}

# resource bigfix multiple_action_group
resource "bigfix_multiple_action_group" "test" {
  # path of xml file containing custom attributes
  input_file_name = "MAG.xml"
  target_computer_id = data.bigfix_computer.linux_vm.id
  site_name = var.linux-sites
}

output "MAG-linux-vm" {
  value = bigfix_multiple_action_group.test.title
}

output "action-state-linux" {
  value = bigfix_multiple_action_group.test.state
}

Building The Provider

NOTE: Unless you are developing or require a pre-release bugfix or feature, you will want to use the officially released version of the provider (see the section above).

Cloning the Project

First, you will want to clone the repository to $GOPATH/src/github.com/terraform-providers/terraform-provider-bigfix:

mkdir -p $GOPATH/src/github.com/terraform-providers
cd $GOPATH/src/github.com/terraform-providers
git clone git@github.com:terraform-providers/terraform-provider-bigfix

Running the Build

After the clone has been completed, you can enter the provider directory and build the provider.

cd $GOPATH/src/github.com/terraform-providers/terraform-provider-bigfix
make build

Installing the Local Plugin

After the build is complete, copy the terraform-provider-bigfix binary into the same path as your terraform binary, and re-run terraform init.

After this, your project-local .terraform/plugins/ARCH/lock.json (where ARCH matches the architecture of your machine) file should contain a SHA256 sum that matches the local plugin. Run shasum -a 256 on the binary to verify the values match.

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.13.1+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

See Building the Provider for details on building the provider.

Checking the Logs

To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled. Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.

To check logs use the following commands :

# Specify Log Level
export TF_LOG=DEBUG
# Specify Log File Path
export TF_LOG_PATH='. . .'

Configuring Environment Variables

Most of the tests in this provider require a comprehensive list of environment variables to run. See the individual *_test.go files in the bigfix/ directory for more details. The next section also describes how you can manage a configuration file of the test environment variables.

Running the Acceptance Tests

In order to perform acceptance tests of bigfix, first set in your environment variables required for the connection (BFX_SERVER, BFX_PORT, BFX_USERNAME, BFX_PASSWORD, BFX_COMPUTER, BFX_INPUT_FILE_NAME, BFX_FIXLET).

For BFX_INPUT_FILE_NAME, give complete path of file.

After this is done, you can run the acceptance tests by running:

$ make testacc

Building The Provider

NOTE: Unless you are developing or require a pre-release bugfix or feature, you will want to use the officially released version of the provider (see the section above).

About

Automates the BigFix execute multi action resource on VM, along with list computer and list fixlet datasources using Terraform Provider.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published