-
Notifications
You must be signed in to change notification settings - Fork 162
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
Api consistency question #550
Comments
Yes, this is correct. We started with the approach of "everything is owned by the builder" model, but as people request the ability to extend the capabilities of each builder to have more flexibility, we can add it. In your case, I suppose what you would like is the ability to create an arbitrary database value (that's no problem, the expression is already there) but to attach it to an already existing server (that was created outside of Farmer)? Or is this more you would like to define a server separately in Farmer and then add items to it over item? |
Yeah, I think my question boils down to how would I create the database if the server already exists. Could you provide some example? Because from samples and documentation, I see all cases where the database should be created only as a child item of the sqlServer builder, via add_database. |
As I said - currently this isn't supported, you can only create a DB on an existing SQL instance. Our position initially has always been to create both server and db through Farmer, although as you point out, with the App Service people came back to us saying that they wanted to attach child resources to parents. It wouldn't be a massive undertaking to do - probably it would be something like this: let theServer = ResourceId.create(Arm.Sql.servers, ResourceName "my-external-sql-server", "my-resource-group")
let db = sqlDb {
name "poolDb1"
sku DtuSku.S1
db_size (1024<Mb> * 128)
attach_to_server theServer
} I'm not sure though whether you can deploy a SQL Database to a separate resource group than the Server - probably not - so you would need to ensure that you deploy your Farmer template to the same RG that the server exists in. |
I think that'd be great and it would give the most flexibility. |
Hi, I have a question regarding the SqlAzure and WebApp api semantics.
The WebApp (AppService) should be assigned to some AppServicePlan in Azure. And so in Farmer, there is a "link_service_plan" that gives ability to attach the new appService to the appservice plan, either new or existing.
However, in AzureSql I see some different api. The individual database is added to the "parent" sql server using the "add_database" syntax inside the sqlServer builder. So if I have already existing sql server, it seems like I cannot just "attach" the sql database to this server. It looks like I always need to create the sqlServer, and add all needed databases in one script.
In general, it seems like AppservicePlan and SqlServer both have similar behavior, because they act as a "container" for the appService and sqlDatabase respectively. But the api semantics is different.
Maybe I'm just overlooking something?
In general, in the current project, I have a need to have single sql server and multiple databases assigned to it. But I cannot create all databases in once, I rather want to separately create the sqlServer, and then have separate deployment for each database. What is the best way to accomplish this?
Thanks
The text was updated successfully, but these errors were encountered: