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

[FEATURE] BTP Terraform Exporter #724

Open
lechnerc77 opened this issue Feb 28, 2024 · 5 comments
Open

[FEATURE] BTP Terraform Exporter #724

lechnerc77 opened this issue Feb 28, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@lechnerc77
Copy link
Member

What area do you want to see improved?

other

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

The Terraform Provider for SAP BTP currently supports the import of resources via the standard functionality of Terraform namely import blocks (link).
This allows our customers to import resources, but the process is quite cumbersome and error-prone.

It would be great to have a dedicated functionality to execute that export in an automated and streamlined way like:

btpexport --subaccount `name of the subaccount`

Describe the solution you would like

I would like to have a solution that fulfills the following requirements:

  • Automatically identify resources to be imported
  • Automatically generate the valid Terraform configuration file:
    • The resource should match its state in the remote platform (verified via terraform plan)
    • Defines the cross resource dependencies
  • Option to automatically generate the Terraform state file
  • Up-to-date support to the provider (Delay between new resources in the Provider and availability in the tool should be minimal)

There will be gaps as some resources might not support the import or the configuration might not be accessible (like for some service instances). This is acceptable as long as it is logged/tracked by the tool in a machine-readable manner e.g. by a dedicated JSON file that highlights the resources that could not be imported.

Describe alternatives you have considered

The Terraformer project initiated by GCP SRE might be an alternative. It is not clear how well maintained this project is and there is no governance described in the repository that outlines contribution and review flows.

Additional context

As a blueprint for the requirement the Microsoft Azure Export for Terraform CLI can be used, as it covers exactly the same requirements, but is of course restricted to Azure:

@lechnerc77 lechnerc77 added enhancement New feature or request pending-decision This issue has not been accepted for implementation nor rejected. It's still open to discussion. labels Feb 28, 2024
Copy link

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

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@lechnerc77
Copy link
Member Author

Additional remark: for a end2end story of an export the role collection assignment would be an important part. However, this resource is not importable due to missing functionality to READ the role collection assignment. This gap is something that probably needs further discussion also in the context of #748

@lechnerc77 lechnerc77 removed the pending-decision This issue has not been accepted for implementation nor rejected. It's still open to discussion. label May 23, 2024
@lechnerc77
Copy link
Member Author

This functionality will be implemented

@ptesny
Copy link

ptesny commented Aug 21, 2024

@lechnerc77
While awaiting the feature to be implemented.

My use case is the internal ArgoCDaaS. I’d like to import/export the ArgoCDaaS service instance binding (different BTP ga and sa) for use with my runtime tf script ( in a different BTP ga/sa);
But this could be applicable to an existing BTP assets like HC,ObjectStore, Postgres, DataSphere, SAC, etc…
Any BTP real estate import example would help.

@lechnerc77
Copy link
Member Author

@ptesny : There is a sample that guides you through the import process: https://github.com/SAP-samples/btp-terraform-samples/tree/main/released/import

It does not yet use the automatic generation (experimental) which would you get rid of crafting the configuration manually. Having said that when executing an import with generating the configuration you will probably need some postprocessing to clean up the generated code.

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