terraform-provider-scaleway
terraform-provider-scaleway copied to clipboard
Add several data sources to ease automation
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
It would be nice to have data sources for the following elements:
- Instance server details like RAM, CPU, GPU provided by
scw instance server-type list -o json
- Available ami available on the account with filtering by tags
New or Affected Resource(s)
- scaleway_instance_server_types
- scaleway_instance_image
Potential Terraform Configuration
data scaleway_instance_image myapp {
tags = ["production","myapp"]
latest = true
}
data scaleway_instance_server_types all{
}
locals {
allowed_app_ram = data.scaleway_instance_server_types.all[var.app_server_type]-100000000
cloud-init = templatefile("cloud-init.yaml.tpl",{app_ram= local.allowed_app_ram})
}
resource "scaleway_instance_server" "web" {
type = var.app_server_type
image = data.scaleway_instance_image.myapp.id
user_data = {
cloud-init = local.cloud-init
}
}