-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
818 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,35 @@ | ||
--- | ||
page_title: "Provider: Jenkins" | ||
description: |- | ||
The Jenkins provider is used to interact with the Jenkins API. | ||
--- | ||
|
||
# Jenkins Provider | ||
|
||
The Jenkins provider is used to interact with the Jenkins API. The provider needs to be configured with the proper credentials before it can be used. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
```terraform | ||
# Configure the Jenkins Provider | ||
provider "jenkins" { | ||
server_url = "https://jenkins.url" # Or use JENKINS_URL env var | ||
username = "username" # Or use JENKINS_USERNAME env var | ||
password = "password" # Or use JENKINS_PASSWORD env var | ||
ca_cert = "" # Or use JENKINS_CA_CERT env var | ||
} | ||
# Create a Jenkins job | ||
resource "jenkins_job" "example" { | ||
# ... | ||
server_url = "http://localhost:8080" # Or JENKINS_URL env var | ||
username = "admin" # Or JENKINS_USERNAME env var | ||
password = "admin" # Or JENKINS_PASSWORD env var | ||
ca_cert = "" # Or JENKINS_CA_CERT env var | ||
} | ||
``` | ||
|
||
## Authentication | ||
|
||
Jenkins uses a user/password challenge for authentication. It requires a username & password for determining identity and permissions. This method also supports Jenkins' various authentication plugins, such as GitHub OAuth (through the use of Personal Access Tokens). | ||
|
||
### Static credentials ### | ||
|
||
Static credentials can be provided by adding a `username` and `password` in-line in the Jenkins provider block: | ||
|
||
Usage: | ||
|
||
```hcl | ||
provider "jenkins" { | ||
server_url = "https://jenkins.url" | ||
username = "username" | ||
password = "password" | ||
} | ||
``` | ||
|
||
### Environment variables | ||
|
||
You can provide your credentials via the `JENKINS_USERNAME` and `JENKINS_PASSWORD`, environment variables. `JENKINS_URL` is also available which will assign the `server_url` property. | ||
|
||
```hcl | ||
provider "jenkins" {} | ||
``` | ||
|
||
Usage: | ||
|
||
```sh | ||
$ export JENKINS_URL="https://jenkins.url" | ||
$ export JENKINS_USERNAME="username" | ||
$ export JENKINS_PASSWORD="password" | ||
$ terraform plan | ||
``` | ||
|
||
## Argument Reference | ||
|
||
In addition to [generic `provider` arguments](https://www.terraform.io/docs/configuration/providers.html) (e.g. `alias` and `version`), the following arguments are supported in the Jenkins `provider` block: | ||
|
||
* `server_url` - (Required) This is the Jenkins server URL. It should be fully qualified (e.g. `https://...`) and point to the root of the Jenkins server location. | ||
|
||
* `username` - (Optional) This is Jenkins username for authentication. | ||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
* `password` - (Optional) This is the Jenkins password for authentication. If you are using the GitHub OAuth authentication method, enter your Personal Access Token here. | ||
### Optional | ||
|
||
* `ca_cert` - (Optional) This is the path to the self-signed certificate that may be required in order to authenticate to your Jenkins instance. | ||
- `ca_cert` (String) The path to the Jenkins self-signed certificate. It may be required in order to authenticate to your Jenkins instance. | ||
- `password` (String) The password to authenticate to Jenkins. If you are using the GitHub OAuth authentication method, enter your Personal Access Token here. | ||
- `server_url` (String) The URL of the Jenkins server to connect to. It should be fully qualified (e.g. `https://...`) and point to the root of the Jenkins server location. | ||
- `username` (String) The username to authenticate to Jenkins. |
4 changes: 4 additions & 0 deletions
4
examples/data-sources/jenkins_credential_username/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "jenkins_credential_username" "example" { | ||
name = "name" | ||
folder = jenkins_folder.example.id | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/data-sources/jenkins_credential_vault_approle/data-source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "jenkins_credential_vault_approle" "example" { | ||
name = "name" | ||
folder = jenkins_folder.example.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Configure the Jenkins Provider | ||
provider "jenkins" { | ||
server_url = "http://localhost:8080" # Or JENKINS_URL env var | ||
username = "admin" # Or JENKINS_USERNAME env var | ||
password = "admin" # Or JENKINS_PASSWORD env var | ||
ca_cert = "" # Or JENKINS_CA_CERT env var | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Integration | ||
|
||
This folder contains an example Dockerized instance of Jenkins for performing manual testing against. It can be used during development to validate against a real Jenkins installation. | ||
|
||
## Usage | ||
|
||
Start Jenkins with: | ||
|
||
```sh | ||
docker-compose up --detach | ||
``` | ||
|
||
And then open it in your web browser at http://localhost:8080. | ||
|
||
You can now run `terraform init`, `plan`, `apply`, etc. commands within this directory to test the provider against the Jenkins instance. If you are testing a version of the provider that you are developing locally, ensure that you've run the `make` command in the repository root and followed the provided instructions to configure your machine to use the built binary. | ||
|
||
When done with testing, clean up the instance with: | ||
|
||
```sh | ||
docker-compose down --volumes | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# jenkins_credential_username Data Source | ||
|
||
Get the attributes of a username credential within Jenkins. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "jenkins_credential_username" "example" { | ||
name = "job-name" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `name` - (Required) The name of the resource being read. | ||
* `domain` - (Optional) The domain store to place the credentials into. If not set will default to the global credentials store. | ||
* `folder` - (Optional) The folder namespace containing this resource. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The full canonical job path, E.G. `/job/job-name`. | ||
* `description` - A human readable description of the credentials being stored. | ||
* `scope` - The visibility of the credentials to Jenkins agents. This must be set to either "GLOBAL" or "SYSTEM". | ||
* `username` - The username to be associated with the credentials. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# jenkins_credential_vault_approle Data Source | ||
|
||
Get the attributes of a Vault AppRole credential within Jenkins. | ||
|
||
~> The Jenkins installation that uses this resource is expected to have the [Hashicorp Vault Plugin](https://plugins.jenkins.io/hashicorp-vault-plugin/) installed in their system. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "jenkins_credential_vault_approle" "example" { | ||
name = "job-name" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `name` - (Required) The name of the resource being read. | ||
* `domain` - (Optional) The domain store to place the credentials into. If not set will default to the global credentials store. | ||
* `folder` - (Optional) The folder namespace containing this resource. | ||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The full canonical job path, E.G. `/job/job-name`. | ||
* `description` - A human readable description of the credentials being stored. | ||
* `scope` - The visibility of the credentials to Jenkins agents. This must be set to either "GLOBAL" or "SYSTEM". | ||
* `namespace` - The Vault namespace of the approle credential. | ||
* `path` - The unique name of the approle auth backend. Defaults to `approle`. | ||
* `role_id` - The role_id to be associated with the credentials. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# jenkins_folder Data Source | ||
|
||
Get the attributes of a folder within Jenkins. | ||
|
||
~> The Jenkins installation that uses this resource is expected to have the [Cloudbees Folders Plugin](https://plugins.jenkins.io/cloudbees-folder) installed in their system. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "jenkins_folder" "example" { | ||
name = "folder-name" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `name` - (Required) The name of the folder being read. | ||
* `folder` - (Optional) The folder namespace containing this folder. | ||
|
||
|
||
## Attribute Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The full canonical folder path, E.G. `/job/parent`. | ||
* `description` - A block of text describing the folder's purpose. | ||
* `display_name` - The name of the folder that is displayed in the UI. | ||
* `template` - A Jenkins-compatible XML template to describe the folder. |
Oops, something went wrong.