SAP / terraform-provider-btp

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

[FEATURE] remote backends: s3, HTTP and kubernetes secrets examples #885

Closed ptesny closed 3 months ago

ptesny commented 3 months ago

What area do you want to see improved?

examples

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

A backend defines where Terraform stores its state data files.

Looking for an example of how to implement S3, kubernetes secret and HTTP based remote backends.

Describe the solution you would like

This is to able to able to implement a sharable tf state solution.

Describe alternatives you have considered

No response

Additional context

No response

github-actions[bot] commented 3 months 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 months ago

@ptesny samples and examples are usually located in the Terraform samples repository. Here you find examples for Kubernetes and Artifactory as state backend: https://github.com/SAP-samples/btp-terraform-samples/tree/main/released/terraform-be

If you want to see a Azure Blob Storage configuration, you can get some information here (in the context of drift detection:

In general, the official documentation of Hashicorp is imho quite good when it comes to the configurations of the different backend (see backend configuration.

In case you have questions to a specific backend, feel free to start a discussion.

ptesny commented 3 months ago

@lechnerc77, Have you ever tried to use the BTP Object Store service as a backend for tf state ? Do you think your azure blob sample code could work with the ObjectStore ?

lechnerc77 commented 3 months ago

@ptesny no I did not. As the Object Store on BTP is an abstraction layer and I would assume that the APIs do not correspond to the "regular" APIs use in the backend implementations

ptesny commented 3 months ago

@ptesny no I did not. As the Object Store on BTP is an abstraction layer and I would assume that the APIs do not correspond to the "regular" APIs use in the backend implementations

That's why I asked. It it did work it could have been a prominent way of getting the tf state houskept using an existing and affordable BTP service like the ObjectStore.

ptesny commented 3 months ago

@lechnerc77 Do you know if terraform can be run as a k8s workload itself ?

For instance, this guide describes how to use a tf Kubernetes provider, but terraform is still run from a terminal

lechnerc77 commented 3 months ago

Usually you run Terraform from a CI/CD pipeline. You can put the TF binary into a container and deploy/execute the container where you want. The Cloud Automation Team at SAP leverages the approach with TF in a short-lived container inside a K8s cluster. The service is called via REST comprising the Terraform configuration as payload of the request

ptesny commented 3 months ago

What about this terraformer guy? https://github.com/gardener/terraformer ; have you ever used it ? is it what the aforementioned Cloud Automation Team does ?