Skip to content

Richard-Barrett/terraform-artifactory-configuration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-artifactory-configuration

Terraform Module to Manage Artifactory Configurations

This Terraform module is designed to manage three key resources related to JFrog Artifactory: artifactory_backup, artifactory_general_security, and artifactory_mail_server.

  • artifactory_backup handles the backup settings of Artifactory, allowing you to define backup schedules, exclusions, and other related settings.
  • artifactory_general_security manages the general security settings of Artifactory.
  • artifactory_mail_server manages the mail server settings of Artifactory.

The module provides flexibility, allowing you to manage any combination of these resources by setting the corresponding manage_* variables. Each resource has its own set of variables that you need to provide when calling the module.

The module is versioned, ensuring stability and reliability in its usage. However, the actual usage of the module, including the required and optional variables for each resource, may vary depending on the specific implementation of the module.

Example CICD with BitBucket and Codefresh:

Image

Notes

  1. Module Purpose: This Terraform module is designed to manage three key resources related to JFrog Artifactory: artifactory_backup, artifactory_general_security, and artifactory_mail_server.
  2. Resource Management: The module provides flexibility in managing these resources. You can choose to manage one, two, or all three resources at once by setting the manage_backup, manage_general_security, and manage_mail_server variables.
  3. Variables: Each resource has its own set of variables that you need to provide when calling the module. Some variables are required, while others are optional and have default values.
  4. Versioning: The module is versioned, so you can specify the version when calling the module to ensure you're using a stable and tested version.
  5. Usage: The actual usage of the module, including the required and optional variables for each resource, may vary depending on the specific implementation of the module.
  6. Considerations: When using this module, consider the Terraform version, dependencies, permissions, cost, timezone, and security. Make sure your Terraform version is compatible with the module, the dependencies are created before the module is applied, the account running the Terraform scripts has sufficient permissions, the cost fits within your budget, the timezone is correct if you're using cron expressions for scheduling, and sensitive data is handled properly.

Usage

The following includes some examples on how you can use this module.

Minimal Usage

The minimal usage is to manage the general security setting with the manage_general_security set to true:

```hcl
module "artifactory_resources" {
  source  = "https://github.com/Richard-Barrett/terraform-artifactory-configuration"
  version = "1.0.0"

  manage_backup = false
  manage_general_security = true
  manage_mail_server = false

  // Variables for artifactory_general_security
  // Fill these in as needed
  // ...
}

NOTE: YOU ARE ONLY MANAGING ANONYMOUS ACCESS AND NOT THE BACKUP OR MAIL SERVER WITH THIS CONFIGURATION

Basic Usage

To use the module, you need to call it in your Terraform configuration and provide values for the required variables. Here's an example:

module "artifactory_resources" {
  source  = "https://github.com/Richard-Barrett/terraform-artifactory-configuration"
  version = "1.0.0"

  manage_backup = true
  manage_general_security = false
  manage_mail_server = true

  // Variables

 for

 artifactory_backup
  key = "backup_key"
  cron_exp = "0 17 * * 1-5"
  retention_period_hours = 1000
  excluded_repositories = []
  create_archive = false
  exclude_new_repositories = true
  send_mail_on_error = true
  verify_disk_space = true
  export_mission_control = true

  // Variables for artifactory_mail_server
  // Fill these in as needed
  // ...
}

In this example, the artifactory_backup and artifactory_mail_server resources will be managed, but the artifactory_general_security resource will not be managed because manage_general_security is set to false. The rest of the variables are the inputs to your module, which correspond to the properties of the artifactory_backup, artifactory_general_security, and artifactory_mail_server resources. You need to fill in the variables for artifactory_mail_server as needed.

If you only want to manage the artifactory_backup resource, you can set the manage_backup variable to true and the manage_general_security and manage_mail_server variables to false. Here's an example:

module "artifactory_resources" {
  source  = "https://github.com/Richard-Barrett/terraform-artifactory-configuration"
  version = "1.0.0"

  manage_backup = true
  manage_general_security = false
  manage_mail_server = false

  // Variables for artifactory_backup
  key = "backup_key"
  cron_exp = "0 17 * * 1-5"
  retention_period_hours = 1000
  excluded_repositories = []
  create_archive = false
  exclude_new_repositories = true
  send_mail_on_error = true
  verify_disk_space = true
  export_mission_control = true
}

In this example, only the artifactory_backup resource will be managed. The artifactory_general_security and artifactory_mail_server resources will not be managed because their corresponding variables are set to false.

If you only want to manage the artifactory_general_security resource, you can set the manage_general_security variable to true and the manage_backup and manage_mail_server variables to false. Here's an example:

module "artifactory_resources" {
  source  = "https://github.com/Richard-Barrett/terraform-artifactory-configuration"
  version = "1.0.0"

  manage_backup = false
  manage_general_security = true
  manage_mail_server = false

  // Variables for artifactory_general_security
  // Fill these in as needed
  // ...
}

In this example, only the artifactory_general_security resource will be managed. The artifactory_backup and artifactory_mail_server resources will not be managed because their corresponding variables are set to false.

Advanced Usage with All Inputs Plus Options

Advanced usage of the module would involve setting more variables and possibly using more complex values. Here's an example:

module "artifactory_resources" {
  source  = "https://github.com/Richard-Barrett/terraform-artifactory-configuration"
  version = "1.0.0"

  manage_backup = true
  manage_general_security = true
  manage_mail_server = true

  // Advanced variables for artifactory_backup
  key = "backup_key"
  cron_exp = "0 17 * * 1-5"
  retention_period_hours = 1000
  excluded_repositories = ["repo1", "repo2"]
  create_archive = true
  exclude_new_repositories = false
  send_mail_on_error = true
  verify_disk_space = true
  export_mission_control = true

  // Advanced variables for artifactory_general_security
  // Fill these in as needed
  // ...

  // Advanced variables for artifactory_mail_server
  // Fill these in as needed
  // ...
}

In this example, all three resources will be managed because their corresponding variables are set to true. The artifactory_backup resource has more complex values for excluded_repositories and create_archive. The rest of the variables are the advanced inputs to your module, which correspond to the properties of the artifactory_backup, artifactory_general_security, and artifactory_mail_server resources. You need to fill in the advanced variables for artifactory_general_security and artifactory_mail_server as needed.

Considerations

When using this module, consider the following:

  1. Resource Management: You have the flexibility to manage one, two, or all three resources (artifactory_backup, artifactory_general_security, artifactory_mail_server) at once. Make sure to set the manage_* variables correctly based on your needs.
  2. Required Variables: Each resource likely has required variables that you must provide. Ensure you understand what each variable represents and provide appropriate values.
  3. Optional Variables: There may be optional variables that have default values. You can override these defaults if necessary.
  4. Module Version: Always specify the version of the module to ensure you're using a stable and tested version that won't change unexpectedly.
  5. Terraform Version: Make sure your Terraform version is compatible with the module. Some modules require a minimum Terraform version.
  6. Dependencies: If the module depends on other resources being present (like a network or a storage account), make sure those resources are created before the module is applied.
  7. Permissions: Ensure that the account running the Terraform scripts has sufficient permissions to create, update, and delete the resources managed by the module.
  8. Cost: Each resource created by the module may incur costs. Make sure you understand the pricing for each resource and that it fits within your budget.
  9. Timezone: If you're using cron expressions for scheduling, remember that the timezone is based on the server where the job is running. Adjust the time in the cron expression accordingly if your server is in a different timezone.
  10. Security: Be careful with sensitive data. Use Terraform variables or secrets management systems to handle sensitive data like passwords or API keys.

Overview

This Terraform module manages three resources related to JFrog Artifactory: artifactory_backup, artifactory_general_security, and artifactory_mail_server.

  1. artifactory_backup: This resource manages the backup settings of Artifactory. It allows you to define when and how backups are performed, which repositories to exclude from backups, and other backup-related settings.
  2. artifactory_general_security: This resource manages the general security settings of Artifactory. It can be used to configure various security-related settings.
  3. artifactory_mail_server: This resource manages the mail server settings of Artifactory. It allows you to define the mail server that Artifactory uses to send emails.

The module provides flexibility in managing these resources. You can choose to manage one, two, or all three resources at once by setting the manage_backup, manage_general_security, and manage_mail_server variables.

Each resource has its own set of variables that you need to provide when calling the module. Some variables are required, while others are optional and have default values.

The module is versioned, so you can specify the version when calling the module to ensure you're using a stable and tested version.

Please note that the actual usage of the module, including the required and optional variables for each resource, may vary depending on the specific implementation of the module.

Inputs

Requirements

Name Version
terraform >= 1.5.6
artifactory 10.7.6

Providers

Name Version
artifactory 10.7.6

Modules

No modules.

Resources

Name Type
artifactory_backup.this resource
artifactory_general_security.this resource
artifactory_mail_server.this resource

Inputs

Name Description Type Default Required
artifactory_url URL of the Artifactory instance string "http://localhost:8081/artifactory" no
create_archive Whether to create an archive bool false no
cron_exp Cron expression for backup string "0 0 12 * * ? *" no
enable_anonymous_access Whether to enable anonymous access bool true no
enabled Whether to enable the mail server bool true no
exclude_new_repositories Whether to exclude new repositories bool true no
excluded_repositories List of repositories to exclude list(string) [] no
export_mission_control Whether to export to mission control bool true no
from Email address to send from string "" no
host Host of the mail server string "" no
key Unique key for the backup string "backup" no
manage_backup Whether to manage the backup resource bool true no
manage_general_security Whether to manage the general security resource bool true no
manage_mail_server Whether to manage the mail server resource bool true no
password Password for the mail server string "" no
port Port of the mail server number 25 no
retention_period_hours Retention period in hours number 24 no
send_mail_on_error Whether to send mail on error bool true no
subject_prefix Prefix for the subject of the email string "[Artifactory]" no
use_ssl Whether to use SSL for the mail server bool true no
use_tls Whether to use TLS for the mail server bool true no
username Username for the mail server string "" no
verify_disk_space Whether to verify disk space bool true no

Outputs

No outputs.

About

Terraform Module to Manage Artifactory Configurations

Resources

License

Stars

Watchers

Forks

Packages

No packages published