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

Datasource support to Read CMS #1277

Closed
ifs-hamoucheaitalioua opened this issue Apr 8, 2020 · 11 comments
Closed

Datasource support to Read CMS #1277

ifs-hamoucheaitalioua opened this issue Apr 8, 2020 · 11 comments
Assignees

Comments

@ifs-hamoucheaitalioua
Copy link

Hi there,

We would like to export the certificate from CMS resource, to be able to upload it into the kubernetes secret with native TF resource, instead of using a null_resource and bash scripts.

Thanks in advance

@hkantare
Copy link
Collaborator

@pauljegouic
Copy link

pauljegouic commented Apr 14, 2020

Thanks @hkantare.

But how to retrieve the certificate CRN using Terraform ?

@hkantare
Copy link
Collaborator

We do have Terraform support to create or import certificate into CMS
https://cloud.ibm.com/docs/terraform?topic=terraform-cert-manager-resources

@pauljegouic
Copy link

I know, but there is no way to retrieve it once created. There is no datasource for CMS. That's our request

@hkantare
Copy link
Collaborator

Ok..May be can you change the issue somethink like Datasource support to Read CMS

@ifs-hamoucheaitalioua ifs-hamoucheaitalioua changed the title Support for certificate on CMS resource Datasource support to Read CMS Apr 14, 2020
@hkantare
Copy link
Collaborator

hkantare commented May 4, 2020

@pauljegouic
Copy link

@hkantare not sure if using it well but here are my result (which are not satisfying)

variable "region" {
  default = "eu-de"
}


provider ibm {
  region = var.region
  generation       = 1
  ibmcloud_timeout = 60
}

data "ibm_resource_group" "id" {
  name = "Default"
}

data "ibm_resource_instance" "cm" {
    name     = "cms-skt-integration.ibm.ifsalpha.com"
    location = var.region
    service  = "cloudcerts"
    resource_group_id = data.ibm_resource_group.id.id
}
data "ibm_certificate_manager_certificates" "certs"{
    certificate_manager_instance_id=data.ibm_resource_instance.cm.id
}

output "debug" {
  value = data.ibm_certificate_manager_certificates.certs
}

Outputs:

➜  Desktop terraform apply
data.ibm_resource_group.id: Refreshing state...
data.ibm_resource_instance.cm: Refreshing state...
data.ibm_certificate_manager_certificates.certs: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

debug = {
  "certificate_manager_instance_id" = "crn:v1:bluemix:public:cloudcerts:eu-de:a/67a4395fde4e4e0ca52f5554b249ceb7:835761c5-f7aa-484c-ac56-313d1011ab1f::"
  "id" = "crn:v1:bluemix:public:cloudcerts:eu-de:a/67a4395fde4e4e0ca52f5554b249ceb7:835761c5-f7aa-484c-ac56-313d1011ab1f::"
}

@pauljegouic
Copy link

pauljegouic commented May 19, 2020

Obivously:

image
image

The credentials of the user that can see the certificate in the GUI has been used for Terraform

@hkantare
Copy link
Collaborator

Fixed in latest release v1.6.0 & v1.5.3
https://github.com/IBM-Cloud/terraform-provider-ibm/releases/tag/v1.6.0

@pauljegouic
Copy link

Integrated. Resolved, thanks

@ifs-hamoucheaitalioua
Copy link
Author

Resolved, thanks

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

No branches or pull requests

4 participants