Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parameters are required for resource(repository) creation. Example declaration statement missing?. #48

Closed
5obol opened this issue May 26, 2020 · 13 comments
Labels
enhancement New feature or request

Comments

@5obol
Copy link

5obol commented May 26, 2020

Hi guys

Can you please point me at all possible parameters for the resources creation?
E.G. I am creating repository of type proxy and format apt :

  name   = "apt-proxy-bionic"
  format = "apt"
  type   = "proxy"
  apt {
    distribution = "bionic"
  }
  storage {
    blob_store_name                = "apt-internal"
    strict_content_type_validation = true
    write_policy                   = "ALLOW_ONCE"
  }
  depends_on = [nexus_blobstore.apt-internal]
}
Once I run apply:
nexus_repository.apt-proxy-bionic: Creating...
Error: could not create repository 'apt-proxy-bionic': HTTP: 400, [ {
  "id" : "PARAMETER httpClient",
  "message" : "must not be null"
}, {
  "id" : "PARAMETER negativeCache",
  "message" : "must not be null"
}, {
  "id" : "PARAMETER proxy",
  "message" : "must not be null"
}, {
  "id" : "PARAMETER flat",
  "message" : "must not be null"
} ]
  on repositories.tf line 1, in resource "nexus_repository" "apt-proxy-bionic":
   1: resource "nexus_repository" "apt-proxy-bionic" {

I do have those section in my real repo and would like them to be declared even with null or empry values. But I can’t figure out how to define them. And can’t even find them in repository’s resource GO code as of here:
https://github.com/datadrivers/terraform-provider-nexus/blob/master/nexus/resource_repository.go
It would be nice to have full list of possible parameters or just 1 big example with all possible options provided. It would make it much more easier using this provider. I think it can be applied to all the resources.

@Nosmoht
Copy link
Contributor

Nosmoht commented May 26, 2020

Hi @5obol,

please see the examples for nuget_proxy and docker_hub within README.md. The errors you got are only for repositories of type proxy.

@5obol
Copy link
Author

5obol commented May 26, 2020

Hi,
Thank you for such a quick reply and action on this.
Have just went through those two examples as well. And here what I have in a TF code:

resource "nexus_repository" "apt-proxy-bionic" {
  name   = "apt-proxy-bionic"
  format = "apt"
  type   = "proxy"
  online = true
  apt {
    distribution = "bionic"
  }
  negative_cache {
    enabled = true
    ttl     = 1440
  }
  http_client {
      auto_block = true
  }
  proxy {
    remote_url  = "http://archive.ubuntu.com/ubuntu/"
    metadata_max_age = "1440"
    content_max_age = "1440"
  }
  storage {
    blob_store_name                = "apt-internal"
    strict_content_type_validation = true
    write_policy                   = "ALLOW_ONCE"
  }
  depends_on = [nexus_blobstore.apt-internal]
}

Apply:

$ terraform apply -input=false "planfile"
nexus_repository.apt-proxy-bionic: Creating...
Error: could not create repository 'apt-proxy-bionic': HTTP: 400, [ {
  "id" : "PARAMETER flat",
  "message" : "must not be null"
}, {
  "id" : "PARAMETER type",
  "message" : "may not be empty"
} ]
  on repositories.tf line 1, in resource "nexus_repository" "apt-proxy-bionic":
   1: resource "nexus_repository" "apt-proxy-bionic" {
ERROR: Job failed: exit code 1

@Nosmoht
Copy link
Contributor

Nosmoht commented May 27, 2020

Hi @5obol ,

the issue with parameter type can be fixed by adding authentication even if you don't use username and passwort, it would at least fix the issue. We have another issue to check if authentication can be omitted.

http_client {
      auto_block = true
      authentication {
		type = "username"
      }
  }

Parameter flat is really new to me. Which version of Nexus are u using?

@Nosmoht
Copy link
Contributor

Nosmoht commented May 27, 2020

Found the flat parameter. Seems like following is missing.

   apt {
      distribution = "bionic"
      flat = false
   }

@Nosmoht
Copy link
Contributor

Nosmoht commented May 27, 2020

Foo, this parameter is not yet implemented. I'll add it soon.

@5obol
Copy link
Author

5obol commented May 27, 2020

version

We are using Nexus 3.22.1-02

@fog1985
Copy link

fog1985 commented May 27, 2020

Foo, this parameter is not yet implemented. I'll add it soon.

Cool,
Thank you @Nosmoht beforehand.
As I am facing pretty the same issue. Looking forward to having it added.

@ruedigerblock
Copy link
Member

Moin guys,
we created a new release v1.6.2 which should address this issue.
Please check ;-)

@fog1985
Copy link

fog1985 commented May 28, 2020

Cool! Thank you! ;)

@Nosmoht Nosmoht added the enhancement New feature or request label May 28, 2020
@fog1985
Copy link

fog1985 commented May 28, 2020

Hi @Nosmoht,

All works well. Thank you.

1 more question. Is there a chance to get what data fields/outputs data source for repository has?
I am curious if it's possible to get for example a list of created privileges during the repository creation process and as the result create a role resources with those privileges.
If it's not a correct place to ask this question please let me know and I can raise another topic. :)

Regards,
Taras.

@fog1985
Copy link

fog1985 commented May 29, 2020

Hi @ruedigerblock ,
Thank you as well! And including you into the thread too. :)
Went through everything and can't figure out how to get a list of created privileges by repository resource. Or as the result of repository creation.
Any hints, please?
Cuz trying to create a role with those privileges included and there is no way to get them. :)

@Nosmoht
Copy link
Contributor

Nosmoht commented Jun 5, 2020

Hi @fog1985 ,

i'm closing this ticket as you've already opened #54 for the privileges. Thanks for your support.

@Nosmoht Nosmoht closed this as completed Jun 5, 2020
@fog1985
Copy link

fog1985 commented Jun 5, 2020

Sure. Thank you @Nosmoht .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants