Skip to content

technologies-rules-v3

Variable Service Template

The variability of the following variable service template shall be resolved.

tosca_definitions_version: tosca_variability_1_0_rc_3
node_types:
    application:
        derived_from: tosca.nodes.Root
    ansible_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    terraform_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    ansible_terraform_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    database:
        derived_from: tosca.nodes.Root
    dbms:
        derived_from: tosca.nodes.Root
topology_template:
    variability:
        technology_rules:
            - component: application
              technology: terraform
              hosting:
                  - terraform_host
            - component: application
              technology: terraform
              hosting:
                  - ansible_terraform_host
            - component: another
              technology: terraform
              hosting:
                  - another_terraform_host
            - component: database
              technology:
                  - terraform
            - component: dbms
              technology:
                  - terraform
            - component: application
              technology: ansible
              hosting:
                  - ansible_host
            - component: application
              technology: ansible
              hosting:
                  - ansible_terraform_host
            - component: application
              technology: helm
              hosting:
                  - helm_host
    node_templates:
        application:
            type: application
            persistent: true
            requirements:
                - host:
                      node: ansible_host
                      conditions: false
                - host:
                      node: terraform_host
                      conditions: false
                - host:
                      node: ansible_terraform_host
                - database:
                      node: database
        ansible_host:
            type: ansible_host
        terraform_host:
            type: terraform_host
        ansible_terraform_host:
            type: ansible_terraform_host
        database:
            type: database
            technology: terraform
            requirements:
                - host:
                      node: dbms
        dbms:
            type: dbms
            technology: terraform

Variability-Resolved Service Template

The following variability-resolved service template is expected.

tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
    application:
        derived_from: tosca.nodes.Root
    ansible_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    terraform_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    ansible_terraform_host:
        derived_from: tosca.nodes.Root
        metadata:
            vintner_abstract: 'true'
    database:
        derived_from: tosca.nodes.Root
    dbms:
        derived_from: tosca.nodes.Root
topology_template:
    node_templates:
        application:
            type: application~application::terraform@ansible_terraform_host
            requirements:
                - host: ansible_terraform_host
                - database: database
        ansible_terraform_host:
            type: ansible_terraform_host
        database:
            type: database~database::terraform
            requirements:
                - host: dbms
        dbms:
            type: dbms~dbms::terraform

Last update: November 18, 2024