Allow Terraform Recipes to use version ranges
Closed this issue · 3 comments
AaronCrawfis commented
Current state
Today we accept a templateVersion
which accepts an exact Terraform version.
resource env 'Applications.Core/environments@2022-03-15-privatepreview' = {
name: 'myenv'
properties: {
compute: {}
recipes: {
'Applications.Datastores/redisCaches': {
'default': {
templateKind: 'terraform'
templatePath: 'myregistry/recipes/redis'
templateVersion: '5.1.1'
}
}
}
}
}
Desired state
Environment authors should be able to specify a version range:
resource env 'Applications.Core/environments@2022-03-15-privatepreview' = {
name: 'myenv'
properties: {
compute: {}
recipes: {
'Applications.Datastores/redisCaches': {
'default': {
templateKind: 'terraform'
templatePath: 'myregistry/recipes/redis'
templateVersion: '>= 5.0.0, < 6.0.0'
}
}
}
}
}
kachawla commented
@AaronCrawfis It should work with the current implementation. What was the error when you tried using a range for template version?
sk593 commented
Validated that this works as expected. I uploaded our existing kubernetes-redis recipe to a Terraform registry with a few version tags. Deployed the recipe using a version range and verified successful deployment:
recipes: {
'Applications.Core/extenders': {
default: {
templateKind: 'terraform'
templatePath: 'sk593/redis/kubernetes'
templateVersion: '>= 4.0.0, < 6.0.0'
}
}
}
Logs for downloading latest version in range:
{"severity":"info","timestamp":"2024-01-03T20:44:03.604Z","name":"radius.radiusasyncworker","caller":"terraform/log.go:38","message":"Downloading registry.terraform.io/sk593/redis/kubernetes 5.0.1 for default...\n","serviceName":"radius","version":"0.28","hostName":"applications-rp-5f65647b49-zzh24","resourceId":"/planes/radius/local/resourcegroups/default/providers/Applications.Core/extenders/corerp-resources-terraform-redis","operationId":"b560655e-dd0c-4407-ad39-a0d6ca3880c5","operationType":"APPLICATIONS.CORE/EXTENDERS|PUT","dequeueCount":1,"traceId":"7aa65ea15fa7b6b6bbc25887d37d4e66","spanId":"63eb801840b96cd9"}
Successful deployment:
➜ testdata git:(main) ✗ rad deploy corerp-resources-terraform-redis.bicep --parameters appName=myapp --parameters redisCacheName=mycache
Building corerp-resources-terraform-redis.bicep...
Deploying template 'corerp-resources-terraform-redis.bicep' into environment 'default' from workspace 'dev'...
Deployment In Progress...
Completed corerp-resources-terraform-redis-env Applications.Core/environments
Completed myapp Applications.Core/applications
.. corerp-resources-terraform-redis Applications.Core/extenders
Deployment Complete
Resources:
myapp Applications.Core/applications
corerp-resources-terraform-redis-env Applications.Core/environments
corerp-resources-terraform-redis Applications.Core/extenders
AaronCrawfis commented
Thanks @sk593! Closing this as completed.