
Flamingo
###
# Get Global Account details
###
data "btp_globalaccount" "project" {}
###
# Get Subaccount details
###
data "btp_subaccount" "project" {
id = btp_subaccount.project.id
}
# create a subaccount
resource "btp_subaccount" "project" {
name = lower(var.tenant)
subdomain = lower(var.tenant)
region = lower(var.region)
}
# create a Kyma runtime
data "btp_regions" "all" {}
data "btp_whoami" "me" {}
resource "btp_subaccount_entitlement" "kymaruntime" {
subaccount_id = btp_subaccount.project.id
service_name = "kymaruntime"
plan_name = "trial"
amount = 1
}
resource "btp_subaccount_environment_instance" "kymaruntime" {
subaccount_id = btp_subaccount.project.id
name = var.tenant
environment_type = "kyma"
service_name = btp_subaccount_entitlement.kymaruntime.service_name
plan_name = btp_subaccount_entitlement.kymaruntime.plan_name
parameters = jsonencode({
name = var.tenant
administrators = [data.btp_whoami.me.email]
})
timeouts = {
create = "1h"
update = "35m"
delete = "1h"
}
depends_on = [btp_subaccount_entitlement.kymaruntime]
}
data "http" "kubeconfig" {
url = jsondecode(btp_subaccount_environment_instance.kymaruntime.labels)["KubeconfigURL"]
}
resource "local_sensitive_file" "kubeconfig" {
filename = ".${btp_subaccount.project.id}-${var.tenant}.kubeconfig"
content = data.http.kubeconfig.response_body
}
terraform {
required_providers {
btp = {
source = "sap/btp"
version = "0.6.0-beta1"
}
}
}
# Please checkout documentation on how best to authenticate
# against SAP BTP via the Terraform provider for SAP BTP
provider "btp" {
globalaccount = var.globacct
username = var.username
password = var.password
}
variable "globacct" {
type = string
nullable = false
description = "The Global Account subdomain."
}
variable "username" {
type = string
nullable = false
sensitive = true
description = "Global Administrator e-mail address."
}
variable "password" {
type = string
nullable = false
sensitive = true
description = "Global Administrator password."
}
variable "region" {
type = string
description = "The region where the project account shall be created in."
nullable = false
}
variable "shootname" {
type = string
description = "The Kyma Cluster shootname which the project is deployed to."
default = null
nullable = true
}
variable "subaccount_admins" {
type = list(string)
default = null
description = "The Subaccount Admin(s)."
validation {
condition = (var.subaccount_admins == null || can([for s in var.subaccount_admins : regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$", s)]))
error_message = "Provide a valid subaccount administrator."
}
}
variable "tenant" {
type = string
nullable = false
description = "The name of your subscriber tenant."
validation {
condition = can(regex("^[a-zA-Z0-9_\\-]{1,200}", var.tenant))
error_message = "Provide a valid subscriber tenant name."
}
}
globacct="<your value>"
password="<your value>"
region="us10"
shootname="project"
tenant="project"
username="<your value>"
Terraform Controller
SAP BTP Kyma Cluster US10 - Argo CD App
New SAP BTP Subaccount & Kyma Cluster
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |