Closed cerpass-86LAK closed 1 year ago
I am not able to reproduce the error. Here my Setup:
Initial Setup with entitlement and subscription to BAS:
###
# Creation of subaccount
###
resource "btp_subaccount" "project" {
name = local.project_subaccount_name
subdomain = local.project_subaccount_domain
region = lower(var.region)
}
###
# Entitlement of subaccount for BAS - plan "standard"
###
resource "btp_subaccount_entitlement" "bas_standard" {
subaccount_id = btp_subaccount.project.id
service_name = "sapappstudio"
plan_name = "standard-edition"
}
###
# App subscription of subaccount for BAS - plan "standard"
###
resource "btp_subaccount_subscription" "businessApplicationStudio" {
subaccount_id = btp_subaccount.project.id
app_name = "sapappstudio"
plan_name = "standard-edition"
depends_on = [ btp_subaccount_entitlement.bas_standard ]
}
Result of first terraform apply
:
After that I added the following blocks as you described to the main.tf
:
###
# Entitlement of subaccount for SAP Build Workzone Standard Edition - plan "standard"
###
resource "btp_subaccount_entitlement" "saplaunchpad_standard" {
subaccount_id = btp_subaccount.project.id
service_name = "SAPLaunchpad"
plan_name = "standard"
}
###
# App subscription for SAP Build Workzone Standard Edition - plan "standard"
###
resource "btp_subaccount_subscription" "launchpadService" {
subaccount_id = btp_subaccount.project.id
app_name = "SAPLaunchpad"
plan_name = "standard"
depends_on = [ btp_subaccount_entitlement.saplaunchpad_standard ]
}
Result of second terraform apply
:
@cerpass-86LAK Did you perform any steps in between that impacted the Terraform state?
Hey thanks for the reply. I did not make any changes to state, the code (excluding adding the block in) and ran no other commands in between the two "apply" commands. However after further analysis today. I realised this error is similar to the issue reported in #351. If BAS fails to create and is left in the creation failed state. Instead of trying to create a new one or report its failure it was trying to update the state of it. I mistakenly didn't realise it was due to BAS failing to be subscribed on the first apply. And by chance it happened twice in a row when I tested the full situation again, hence why I thought it was due to adding the other subscribe block. I can see that you have fixed this in #351 so feel free to close this.
Once again, thanks for all your work and fast responses
@cerpass-86LAK : That sounds like the root cause for the issue and is indeed something we detected as a side effect in #351. The issue #351 is fixed with PR #352 and will be available in the next release of the Terraform provider. I will therefore close this issue
Is there an existing issue for this?
What version of Terraform are you using?
0.2.0-beta
What type of issue are you facing
bug report
Describe the bug
throws the above error when trying to add another subscription after already creating a subscription in an earlier apply
Expected Behavior
no errors.
Steps To Reproduce
Setup and create the infrastructure and include the below block.
Then after applying the above and creating the infrastructure. Add the below block and try applying the changes. The below block will force the existing subscription to fail with the above shown api error.
Add screenshots to help explain your problem
The planned changes for BAS subscription is shown below even though it should not be impacted
Additional context
No response