我有一个用于创建子网的openstack模板:
heat_template_version: 2016-04-08
description: subnet
parameters:
subnet_number:
type: string
label: Subnet
description: third octet of target subnet.
contraints:
- range: {min:0, max:255}
description: subnet must be between 0 and 255.
resources:
user_subnet:
type: OS::Neutron::Subnet
properties:
name:
str_replace:
template: $stack-$subnet-subnet
params:
$subnet: {get_param: subnet_number}
$stack: {get_param: "OS::stack_name"}
network_id: {get_resource: user_network}
cidr:
str_replace:
template: 10.$subnet.0.0/24
params:
$subnet: {get_param: subnet_number}
dns_nameservers:
- 8.8.8.8
- 8.8.4.4
现在,我想构建第二个模板,该模板从给定的subnet_number
开始构建给定数量的子网。我目前有以下内容:
heat_template_version: 2016-04-08
description: EDB Schulungsumgebung fuer N TeilnehmerInnen.
parameters:
first_subnet_number:
type: number
label: Subnet
description: third octet of the first target subnet.
contraints:
- range: {min:0, max:255}
description: subnet must be between 0 and 255.
subnet_count:
type: number
default: 2
label: subnet Count
description: number of subnets.
constraints:
- range: {min:1}
description: Number of subnets must be greater than zero.
resources:
subnets:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: subnet_count}
resource_def:
type: template.yaml
properties:
subnet_number: %index%
但这当然总是生成从0开始的子网。
是否有一种方法(例如内在函数)将两个数字相加{add: %index, first_subnet_number}
?
亲切的问候 克莱门斯