<commit_before><commit_msg>RD-716 Add AWS base VM blueprint<commit_after>tosca_definitions_version: cloudify_dsl_1_3

imports:
  - https://cloudify.co/spec/cloudify/5.1.0/types.yaml
  - plugin:cloudify-aws-plugin

inputs:
  test_infrastructure_name: {}
  security_group_id: {}
  subnet_id: {}
  vpc_id: {}
  image_name:
    default: "*"
  image_owner:
    default: "*"
  image_id:
    default: "*"
  flavor: {}
  userdata:
    default: ""
  use_net:
    default: "1"

dsl_definitions:
  client_config: &client_config
    aws_access_key_id: { get_secret: aws_access_key_id }
    aws_secret_access_key: { get_secret: aws_secret_access_key }
    region_name: { get_secret: ec2_region_name }

node_templates:
  vm:
    type: cloudify.nodes.aws.ec2.Instances
    properties:
      agent_config:
        install_method: none
      resource_config:
        ImageId: { get_attribute: [ image, aws_resource_id ] }
        InstanceType: { get_input: flavor }
        kwargs:
          KeyName: { get_input: test_infrastructure_name }
      client_config: *client_config
      Tags:
        - Key: Name
          Value: { get_input: test_infrastructure_name }
    relationships:
      - type: cloudify.relationships.depends_on
        target: nic
      - type: cloudify.relationships.depends_on
        target: ip
      - type: cloudify.relationships.depends_on
        target: image

  nic:
    type: cloudify.nodes.aws.ec2.Interface
    properties:
      client_config: *client_config
      resource_config:
        kwargs:
          Groups:
            - { get_attribute: [ security_group, aws_resource_id ] }
      Tags:
        - Key: Name
          Value: { concat: [ { get_input: test_infrastructure_name }, "-", { get_input: use_net } ] }
    relationships:
      - type: cloudify.relationships.depends_on
        target: subnet
      - type: cloudify.relationships.depends_on
        target: security_group

  ip:
    type: cloudify.nodes.aws.ec2.ElasticIP
    properties:
      client_config: *client_config
      Tags:
        - Key: Name
          Value: { concat: [ { get_input: test_infrastructure_name }, "-", { get_input: use_net } ] }
    relationships:
      - type: cloudify.relationships.depends_on
        target: nic

  subnet:
    type: cloudify.nodes.aws.ec2.Subnet
    properties:
      use_external_resource: true
      resource_id: { get_input: subnet_id }
      client_config: *client_config
      resource_config:
        CidrBlock: 192.168.42.0/24
        AvailabilityZone: { concat: [ { get_secret: ec2_region_name }, 'b' ]}
      Tags:
        - Key: Name
          Value: { concat: [ { get_input: test_infrastructure_name }, "-", { get_input: use_net } ] }

  security_group:
    type: cloudify.nodes.aws.ec2.SecurityGroup
    properties:
      use_external_resource: true
      resource_id: { get_input: security_group_id }
      client_config: *client_config
      resource_config:
        GroupName: { get_input: test_infrastructure_name }
        Description: Security group for tests.
        VpcId: { get_attribute: [ vpc, aws_resource_id] }

  vpc:
    type: cloudify.nodes.aws.ec2.Vpc
    properties:
      use_external_resource: true
      resource_id: { get_input: vpc_id }
      resource_config:
        CidrBlock: 192.168.0.0/16
      Tags:
        - Key: Name
          Value: { get_input: test_infrastructure_name }
      client_config: *client_config

  image:
    type: cloudify.nodes.aws.ec2.Image
    properties:
      resource_config:
        kwargs:
          Filters:
            - Name: name
              Values:
                - { get_input: image_name }
            - Name: state
              Values:
                - available
            - Name: owner-id
              Values:
                - { get_input: image_owner }
            - Name: image-id
              Values:
                - { get_input: image_id }
      client_config: *client_config
{'fraction_non_alphanumeric': 0.09277293695540749, 'fraction_numerical': 0.00999487442337263, 'mean_word_length': 2.249791840133222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1085871', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1246, 'n_words': 230}