-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: add timeout block for subaccount subscription #869
Conversation
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:
terraform {
required_providers {
btp = {
source = "SAP/btp"
version = "~>1.4.0"
}
}
}
# Configure the BTP Provider
provider "btp" {
globalaccount = var.globalaccount
}
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]
}
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Have tested with the provided sample
Purpose
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
go 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: