Closed lechnerc77 closed 4 months ago
Retest for regression was successful, TF framework handles empty timeouts block out of the box, no inconsistencies.
Subscription was CICD application.
Here is the sample configuration used to validate the setup:
provider.tf
terraform {
required_providers {
btp = {
source = "SAP/btp"
version = "~>1.4.0"
}
}
}
# Configure the BTP Provider
provider "btp" {
globalaccount = var.globalaccount
}
main.tf
locals {
project_subaccount_domain = lower("${var.subaccount_name}")
project_subaccount_cf_org = substr(replace("${local.project_subaccount_domain}${var.org}", "-", ""), 0, 32)
}
resource "btp_subaccount" "sa_devops" {
name = var.subaccount_name
subdomain = local.project_subaccount_domain
region = lower(var.region)
labels = var.subaccount_labels
usage = var.subaccount_usage
}
resource "btp_subaccount_entitlement" "cicd_app" {
subaccount_id = resource.btp_subaccount.sa_devops.id
service_name = "cicd-app"
plan_name = var.cicd_service_plan
}
resource "btp_subaccount_subscription" "cicd_app" {
subaccount_id = resource.btp_subaccount.sa_devops.id
app_name = "cicd-app"
plan_name = var.cicd_service_plan
depends_on = [btp_subaccount_entitlement.cicd_app]
}
variables.tf
variable "globalaccount" {
type = string
description = "The globalaccount subdomain where the sub account shall be created."
default = "PUT YOUR GLOBAL ACCOUNT SUBDOMAIN HERE"
}
variable "subaccount_name" {
type = string
description = "The subaccount name."
default = "devopsdemo"
}
variable "region" {
type = string
description = "The region where the sub account shall be created in."
default = "us10"
}
variable "org" {
type = string
description = "Your SAP BTP org e.g. department"
default = "IT"
}
variable "subaccount_usage" {
type = string
description = "The usage type of the subaccount"
default = "NOT_USED_FOR_PRODUCTION"
validation {
condition = contains(["NOT_USED_FOR_PRODUCTION", "USED_FOR_PRODUCTION"], var.subaccount_usage)
error_message = "Invalid value for the subaccount usage. Only 'NOT_USED_FOR_PRODUCTION' and 'USED_FOR_PRODUCTION' are allowed."
}
}
variable "cicd_service_plan" {
type = string
description = "The plan for Continous Integration & Delivery subscription"
default = "default"
validation {
condition = contains(["free", "default"], var.cicd_service_plan)
error_message = "Invalid value for Continous Integration & Delivery. Only 'free' and 'default' are allowed."
}
}
variable "subaccount_labels" {
type = map(set(string))
description = "Labels for subaccount"
default = { CostCenter = ["123456789"] }
}
@vipinvkmenon @CHERIANS: when doing the review, please also validate the regression e.g. via the sample configuration provided above.
Tested with the provided configuration. Works as expected. Empty timeout blocks are also handled properly as mentioned by @lechnerc77
Purpose
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid:
Other Information
n/a
Checklist for reviewer
The following organizational tasks must be completed before merging this PR: