Closed hello-woof closed 3 years ago
Starting a fresh copy of RT pro in a docker container:
314efbc9e4cd docker.bintray.io/jfrog/artifactory-pro "/entrypoint-artifac…" 4 days ago Up 3 days 0.0.0.0:8081-8082->8081-8082/tcp optimistic_keldysh
I use this terraform:
# Required for Terraform 0.13 and up (https://www.terraform.io/upgrade-guides/0-13.html)
terraform {
required_providers {
artifactory = {
source = "registry.terraform.io/jfrog/artifactory"
version = "2.2.6-alpha"
}
}
}
provider "artifactory" {
url = "http://localhost:8082/artifactory"
}
resource "random_id" randid {
count = 4
byte_length = 2
}
resource random_password randpass {
count = 10
length = 16
min_lower = 5
min_upper = 5
min_numeric = 1
min_special = 1
}
resource "artifactory_user" "user" {
count = length(random_password.randpass)
name = "terraform${count.index}"
email = "test-user@artifactory-terraform.com"
groups = ["readers"]
password = random_password.randpass[count.index].result
}
resource "artifactory_remote_repository" "conan-remote" {
key = "conan-remote"
package_type = "conan"
url = "https://conan.bintray.com"
repo_layout_ref = "conan-default"
notes = "managed by terraform"
}
Using the following git details (origin/master/refs/head)
christianb@christianb-mac terraform-provider-artifactory % git remote -v
me git@github.com:chb0github/terraform-provider-artifactory.git (fetch)
me git@github.com:chb0github/terraform-provider-artifactory.git (push)
origin git@github.com:jfrog/terraform-provider-artifactory.git (fetch)
origin git@github.com:jfrog/terraform-provider-artifactory.git (push)
christianb@christianb-mac terraform-provider-artifactory % git branch --show-current
master
christianb@christianb-mac terraform-provider-artifactory % git log -1 --pretty=format:"%h"
d02d860c
I then set credentials as you say:
christianb@christianb-mac terraform-provider-artifactory % export ARTIFACTORY_USERNAME=admin
christianb@christianb-mac terraform-provider-artifactory % export ARTIFACTORY_PASSWORD=password
compile the provider and install it:
go build && mkdir -p .terraform/plugins/registry.terraform.io/jfrog/artifactory/2.2.6-alpha/darwin_amd64/ && cp terraform-provider-artifactory .terraform/plugins/registry.terraform.io/jfrog/artifactory/2.2.6-alpha/darwin_amd64
and run terraform:
christianb@christianb-mac terraform-provider-artifactory % terraform init
Initializing the backend...
Initializing provider plugins...
- Using previously-installed hashicorp/random v3.1.0
- Using previously-installed jfrog/artifactory v2.2.6-alpha
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.
* hashicorp/random: version = "~> 3.1.0"
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
christianb@christianb-mac terraform-provider-artifactory % terraform apply
random_id.randid[2]: Refreshing state... [id=UH0]
random_id.randid[1]: Refreshing state... [id=89U]
random_id.randid[3]: Refreshing state... [id=lu0]
random_id.randid[0]: Refreshing state... [id=UMw]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# artifactory_remote_repository.conan-remote will be created
+ resource "artifactory_remote_repository" "conan-remote" {
+ allow_any_host_auth = (known after apply)
+ blacked_out = (known after apply)
+ block_mismatching_mime_types = (known after apply)
+ bower_registry_url = (known after apply)
+ bypass_head_requests = (known after apply)
+ client_tls_certificate = (known after apply)
+ enable_cookie_management = (known after apply)
+ enable_token_authentication = (known after apply)
+ excludes_pattern = (known after apply)
+ fetch_jars_eagerly = (known after apply)
+ fetch_sources_eagerly = (known after apply)
+ force_nuget_authentication = (known after apply)
+ handle_releases = (known after apply)
+ handle_snapshots = (known after apply)
+ hard_fail = (known after apply)
+ id = (known after apply)
+ includes_pattern = (known after apply)
+ key = "conan-remote"
+ max_unique_snapshots = (known after apply)
+ missed_cache_period_seconds = (known after apply)
+ notes = "managed by terraform"
+ offline = (known after apply)
+ package_type = "conan"
+ pypi_registry_url = (known after apply)
+ remote_repo_checksum_policy_type = (known after apply)
+ repo_layout_ref = "conan-default"
+ retrieval_cache_period_seconds = (known after apply)
+ share_configuration = (known after apply)
+ socket_timeout_millis = (known after apply)
+ store_artifacts_locally = (known after apply)
+ suppress_pom_consistency_checks = (known after apply)
+ synchronize_properties = (known after apply)
+ unused_artifacts_cleanup_period_hours = (known after apply)
+ url = "https://conan.bintray.com"
+ vcs_git_download_url = (known after apply)
+ vcs_git_provider = (known after apply)
+ vcs_type = (known after apply)
+ xray_index = (known after apply)
}
# artifactory_user.user[0] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform0"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[1] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform1"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[2] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform2"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[3] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform3"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[4] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform4"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[5] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform5"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[6] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform6"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[7] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform7"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[8] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform8"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# artifactory_user.user[9] will be created
+ resource "artifactory_user" "user" {
+ admin = (known after apply)
+ disable_ui_access = (known after apply)
+ email = "test-user@artifactory-terraform.com"
+ groups = [
+ "readers",
]
+ id = (known after apply)
+ internal_password_disabled = (known after apply)
+ name = "terraform9"
+ password = (sensitive value)
+ profile_updatable = (known after apply)
}
# random_password.randpass[0] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[1] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[2] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[3] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[4] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[5] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[6] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[7] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[8] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
# random_password.randpass[9] will be created
+ resource "random_password" "randpass" {
+ id = (known after apply)
+ length = 16
+ lower = true
+ min_lower = 5
+ min_numeric = 1
+ min_special = 1
+ min_upper = 5
+ number = true
+ result = (sensitive value)
+ special = true
+ upper = true
}
Plan: 21 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
random_password.randpass[6]: Creating...
random_password.randpass[0]: Creating...
random_password.randpass[3]: Creating...
random_password.randpass[4]: Creating...
random_password.randpass[2]: Creating...
random_password.randpass[5]: Creating...
random_password.randpass[1]: Creating...
random_password.randpass[8]: Creating...
random_password.randpass[7]: Creating...
random_password.randpass[7]: Creation complete after 0s [id=none]
random_password.randpass[2]: Creation complete after 0s [id=none]
random_password.randpass[6]: Creation complete after 0s [id=none]
random_password.randpass[0]: Creation complete after 0s [id=none]
random_password.randpass[8]: Creation complete after 0s [id=none]
random_password.randpass[5]: Creation complete after 0s [id=none]
random_password.randpass[9]: Creating...
random_password.randpass[3]: Creation complete after 0s [id=none]
artifactory_remote_repository.conan-remote: Creating...
random_password.randpass[4]: Creation complete after 0s [id=none]
random_password.randpass[1]: Creation complete after 0s [id=none]
random_password.randpass[9]: Creation complete after 0s [id=none]
artifactory_user.user[4]: Creating...
artifactory_user.user[1]: Creating...
artifactory_user.user[3]: Creating...
artifactory_user.user[6]: Creating...
artifactory_user.user[9]: Creating...
artifactory_user.user[2]: Creating...
artifactory_user.user[7]: Creating...
artifactory_user.user[5]: Creating...
artifactory_user.user[0]: Creating...
artifactory_user.user[0]: Creation complete after 1s [id=terraform0]
artifactory_user.user[3]: Creation complete after 1s [id=terraform3]
artifactory_user.user[7]: Creation complete after 1s [id=terraform7]
artifactory_user.user[6]: Creation complete after 1s [id=terraform6]
artifactory_user.user[1]: Creation complete after 1s [id=terraform1]
artifactory_user.user[5]: Creation complete after 1s [id=terraform5]
artifactory_user.user[9]: Creation complete after 1s [id=terraform9]
artifactory_user.user[8]: Creating...
artifactory_user.user[4]: Creation complete after 1s [id=terraform4]
artifactory_user.user[2]: Creation complete after 1s [id=terraform2]
artifactory_remote_repository.conan-remote: Creation complete after 1s [id=conan-remote]
artifactory_user.user[8]: Creation complete after 0s [id=terraform8]
Apply complete! Resources: 21 added, 0 changed, 0 destroyed.
Please feel free to reopen this issue with a copy-and-paste reproduction of the issue, as following your instructions I am unable to produce it
The option to use env variables as a way to provide authentication does not work when user does not set anything in the provider.
How to reproduce:
Error: either [username, password] or [api_key] or [access_token] must be set to use provider
Expected result: provider should see env variables and set according in schema, if no variables and no arguments given, show above error.