Comments (3)
In general there is no need to interact actively with the Terraform state. All information that the resources expose is part of the documentation of the corresponding resource or data source.
Concerning your setup you must:
- Create the entitlement via the Terraform resource
btp_subaccount_entitlement
- Read the service plan ID via the data source
btp_subaccount_service_plan
- Use the data from the data source to get the service plan ID and then create a service instance via the resource
btp_subaccount_service_instance
This procedure is part of the provider documentation. The Terraform configuration should look like (assuming your subaccount_id
is defined as a variable:
resource "btp_subaccount_entitlement" "alert_notification_service" {
subaccount_id = var.subaccount_id
service_name = "alert-notification"
plan_name = "free"
}
data "btp_subaccount_service_plan" "by_name" {
subaccount_id = var.subaccount_id
name = "free"
offering_name = "alert-notification"
depends_on = [btp_subaccount_entitlement.alert_notification_service]
}
resource "btp_subaccount_service_instance" "alert_notification_free" {
subaccount_id = var.subaccount_id
serviceplan_id = data.btp_subaccount_service_plan.by_name.id
name = "my-alert-notification-instance-new"
}
Be aware that the dependency between the entitlement and the reading of the service plan must be modelled explicitly via depends_on
.
from btp-terraform-samples.
I just tested it on a productive account and it worked (except for one typo in the code above that is now fixed).
The result is as expected:
btp_subaccount_entitlement.alert_notification_service: Creating...
btp_subaccount_entitlement.alert_notification_service: Still creating... [10s elapsed]
btp_subaccount_entitlement.alert_notification_service: Still creating... [20s elapsed]
btp_subaccount_entitlement.alert_notification_service: Creation complete after 21s [id=alert-notification-free]
data.btp_subaccount_service_plan.by_name: Reading...
data.btp_subaccount_service_plan.by_name: Read complete after 1s [id=xxx]
btp_subaccount_service_instance.alert_notification_free: Creating...
btp_subaccount_service_instance.alert_notification_free: Creation complete after 9s [id=xxx]
and the service instance got created. I assume that there is an issue in your subaccount in general.
from btp-terraform-samples.
I have utilized the above terraform configuration but I got the same error again
btp_subaccount_entitlement.alert_notification_service: Creating...
btp_subaccount_service_instance.alert_notification_free: Creating...
btp_subaccount_entitlement.alert_notification_service: Still creating... [10s elapsed]
btp_subaccount_entitlement.alert_notification_service: Still creating... [20s elapsed]
btp_subaccount_entitlement.alert_notification_service: Creation complete after 23s [id=alert-notification-free]
data.btp_subaccount_service_plan.by_name: Reading...
data.btp_subaccount_service_plan.by_name: Read complete after 0s [id=24b7e4c1-59f9-437d-8f2a-675c63c2829c]
╷
│ Error: API Error Creating Resource Service Instance (Subaccount)
│
│ with btp_subaccount_service_instance.alert_notification_free,
│ on main.tf line 25, in resource "btp_subaccount_service_instance" "alert_notification_free":
│ 25: resource "btp_subaccount_service_instance" "alert_notification_free" {
│
│ NotFound
from btp-terraform-samples.
Related Issues (20)
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Terraform SAP provider 500 error while provisioning multiple resources HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure
- Automated Issue Alert: DC Missions Scenario Tests Failure HOT 1
- Automated Issue Alert: DC Missions Scenario Tests Failure
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btp-terraform-samples.