SAP / terraform-provider-btp

Terraform provider for SAP BTP
https://registry.terraform.io/providers/SAP/btp/latest
Apache License 2.0
84 stars 18 forks source link

[FEATURE] Add destination resource #931

Open MarcusNotheis opened 11 hours ago

MarcusNotheis commented 11 hours ago

What area do you want to see improved?

terraform provider

Is your feature request related to a problem? Please describe.

We would like to manage our destinations in an instance of the BTP Destination Service via terraform. Therefore, we would like to create, update and delete destinations on both subaccount and instance level.

Describe the solution you would like

Manage destinations via terraform with a btp_destination resource:

resource "btp_destination" "my_serviceinstance" {
  service_instance_id = "uuid-goes-here"
  service_key         = "terraform-automation"
  name                = "my-destination"
  type                = "HTTP" # enum with other types
  proxy_type          = "Internet"
  description         = "Destination to sap.com"
  url                 = "https://sap.com"
  authentication      = "NoAuthentication" # enum with other auth types
  # if authentication would be OAuth2JWTBearer, then authentication_properties would need to be passed as well
  authentication_properties = jsondecode({
    tokenServiceURLType = "Dedicated"
    clientId : data.some_secure_source_like_vault.clientId
    clientSecret : data.some_secure_source_like_vault.clientSecret
    tokenServiceURL : "https://..."
  })
  additional_properties = jsondecode({
    foo = "bar"
  })
}

Maybe it would also make sense to model each authentication type as a dedicated resource to make sure required parameters are passed during terraform plan.

Based on the instance id and the service key, the BTP provider could read the required credentials and create/update/delete the destination via API calls to the destination service.

Describe alternatives you have considered

We might use the cloudfoundry_service_instance from the sap/cloudfoundry provider and pass all destinations as init_data, but this JSON would become huge when maintaining lots of different destinations.

Additional context

No response

github-actions[bot] commented 11 hours ago

Thanks for the feature request. We evaluate it and update the issue accordingly.

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

lechnerc77 commented 3 hours ago

@MarcusNotheis we are working on providing a dedicated resource for destinations as proposed in you feature request. As this is not only a topic of the Terraform provider, some pre-work needs to be done before offering a new resource in the provider. As of now we cannot give an ETA for the resource, however we ca already say that this won't land in the the first half of 2025.

Concerning the current options you have: as you rightfully stated you can use the service instance resource for Cloud Foundry or the service instance resource for SAP BTP. However, please be aware of the restrictions that these resources for service instances with dedicated (= JSON encoded) parameters have concerning drift detection and import.