Skip to content
Snippets Groups Projects
Commit ff60689b authored by debora.benedetto@hpe.com's avatar debora.benedetto@hpe.com
Browse files

refactoring and bugfix

parent 5395651a
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ def create_iac_from_intermediate_representation(intermediate_representation: dic ...@@ -19,7 +19,7 @@ def create_iac_from_intermediate_representation(intermediate_representation: dic
@api_router.post("/iac/files") @api_router.post("/iac/files")
def create_iac_from_doml(data: str = Body(..., media_type="application/xml")): def create_iac_from_doml(data: str = Body(..., media_type="application/xml")):
logging.info("Received create_iac_from_doml request") logging.info("Received create_iac_from_doml request")
compress_folder_info = Orchestrator.create_iac_from_doml(model=data, metamodel_directory="icgparser/doml", compress_folder_info = Orchestrator.create_iac_from_doml(model=data, metamodel_directory="icgparser/doml/v1",
is_multiecore_metamodel=False) is_multiecore_metamodel=False)
return FileResponse(path=compress_folder_info.file_path, media_type='application/octet-stream', return FileResponse(path=compress_folder_info.file_path, media_type='application/octet-stream',
filename=compress_folder_info.filename) filename=compress_folder_info.filename)
...@@ -89,7 +89,7 @@ def compress_file(source_folder, dest_file_name): ...@@ -89,7 +89,7 @@ def compress_file(source_folder, dest_file_name):
def create_temp_model_file(model_xml): def create_temp_model_file(model_xml):
logging.info("Saving model in temp file") logging.info("Saving model in temp file")
temp_model_file_path = "icgparser/doml/nginx-openstack.domlx" temp_model_file_path = "icgparser/doml/v1/nginx-openstack_v1.domlx"
save_file(model_xml, temp_model_file_path) save_file(model_xml, temp_model_file_path)
logging.info(f"Successfully saved model in temp file at {temp_model_file_path}") logging.info(f"Successfully saved model in temp file at {temp_model_file_path}")
return temp_model_file_path return temp_model_file_path
......
...@@ -125,7 +125,7 @@ def load_metamodel(metamodel_directory=METAMODEL_DIRECTORY, is_multiecore=False) ...@@ -125,7 +125,7 @@ def load_metamodel(metamodel_directory=METAMODEL_DIRECTORY, is_multiecore=False)
mm_root = resource.contents[0] # Get the root of the MetaModel (EPackage) mm_root = resource.contents[0] # Get the root of the MetaModel (EPackage)
rset.metamodel_registry[mm_root.nsURI] = mm_root rset.metamodel_registry[mm_root.nsURI] = mm_root
else: else:
logging.info(f"Loading multiecore metamodel from {metamodel_directory}/doml.ecore") logging.info(f"Loading ecore metamodel from {metamodel_directory}/doml.ecore")
resource = rset.get_resource(URI(f"{metamodel_directory}/doml.ecore")) resource = rset.get_resource(URI(f"{metamodel_directory}/doml.ecore"))
mm_root = resource.contents[0] # Get the root of the MetaModel (EPackage) mm_root = resource.contents[0] # Get the root of the MetaModel (EPackage)
rset.metamodel_registry[mm_root.nsURI] = mm_root rset.metamodel_registry[mm_root.nsURI] = mm_root
......
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml">
<eAnnotations source="emf.gen">
<details key="basePackage" value="eu.piacere.doml"/>
<details key="fileExtensions" value="domlx"/>
<details key="complianceLevel" value="JDK80"/>
</eAnnotations>
<eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons"
nsPrefix="commons">
<eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1"
eType="#//concrete/ConcreteInfrastructure" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1"
eType="#//commons/Configuration" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration"
eType="#//commons/Configuration"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure"
eType="#//concrete/ConcreteInfrastructure"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements"
upperBound="-1" eType="#//commons/Requirement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Property">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//commons/DOMLElement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1"
eType="#//commons/Property" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1"
eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1"
eType="#//commons/Deployment" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Deployment">
<eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1"
eType="#//application/ApplicationComponent"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1"
eType="#//infrastructure/InfrastructureElement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Requirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="identifier" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1"
eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true"
eSuperTypes="#//commons/Requirement"/>
<eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement"
eSuperTypes="#//commons/DeploymentRequirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement"
eSuperTypes="#//commons/DeploymentRequirement">
<eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1"
eType="#//infrastructure/InfrastructureElement"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application"
nsPrefix="app">
<eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1"
eType="#//application/ApplicationComponent" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true"
eSuperTypes="#//commons/DOMLElement"/>
<eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="configFile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1"
eType="#//application/SoftwareInterface" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1"
eType="#//application/SoftwareInterface"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/>
<eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1"
eType="#//application/SoftwareInterface" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/>
<eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/>
</eSubpackages>
<eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure"
nsPrefix="infra">
<eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
eType="#//infrastructure/ComputingNode" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1"
eType="#//infrastructure/VPC" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="secGroups" upperBound="-1"
eType="#//infrastructure/SecurityGroup" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1"
eType="#//infrastructure/ComputingNodeGenerator" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1"
eType="#//infrastructure/Storage" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1"
eType="#//infrastructure/FunctionAsAService" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1"
eType="#//infrastructure/Credentials" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1"
eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingNode">
<eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1"
eType="#//infrastructure/VirtualMachine" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"
defaultValueLiteral="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"
defaultValueLiteral="1"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="deploymentNetwork" eType="#//infrastructure/Network"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind"
defaultValueLiteral="DEFAULT"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind">
<eLiterals name="DEFAULT"/>
<eLiterals name="INTERNAL" value="1"/>
<eLiterals name="EXTERNAL" value="2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRanges" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="RuleKind">
<eLiterals name="EGRESS"/>
<eLiterals name="INGRESS" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//infrastructure/ComputingGroup">
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1"
eType="#//infrastructure/Rule" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1"
eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/>
<eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true"
eSuperTypes="#//commons/DOMLElement"/>
<eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="memory" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1"
eType="#//infrastructure/NetworkInterface" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//infrastructure/Credentials"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup"
eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true"
eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind">
<eLiterals name="SCRIPT"/>
<eLiterals name="IMAGE" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator">
<eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1"
eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator">
<eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers"
upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/>
<eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage"
eOpposite="#//infrastructure/VMImage/generatedVMs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode">
<eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage"
eOpposite="#//infrastructure/ContainerImage/generatedContainers"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Network" abstract="true" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1"
eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="igws" upperBound="-1"
eType="#//infrastructure/InternetGateway" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VPC" eSuperTypes="#//infrastructure/Network">
<eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1"
eType="#//infrastructure/Subnet" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network">
<eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1"
eType="#//infrastructure/Subnet"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network"
eOpposite="#//infrastructure/Network/connectedIfaces"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup"
eOpposite="#//infrastructure/SecurityGroup/ifaces"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"/>
<eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1"
eType="#//infrastructure/NetworkInterface" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1"
eType="#//infrastructure/NetworkInterface" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/>
<eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//infrastructure/Credentials">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//infrastructure/Credentials">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/>
</eSubpackages>
<eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete"
nsPrefix="concrete">
<eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1"
eType="#//concrete/RuntimeProvider" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1"
eType="#//concrete/VirtualMachine" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1"
eType="#//concrete/VMImage" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1"
eType="#//concrete/ContainerImage" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1"
eType="#//concrete/Network" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1"
eType="#//concrete/Storage" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1"
eType="#//concrete/FunctionAsAService" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1"
eType="#//concrete/ComputingGroup" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/>
</eSubpackages>
<eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization"
nsPrefix="optimization">
<eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1"
eType="#//optimization/OptimizationSolution" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1"
eType="#//optimization/OptimizationObjective" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements"
upperBound="-1" eType="#//commons/Requirement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"/>
<eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true"
eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="Max"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/>
<eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/>
<eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/>
</eSubpackages>
</ecore:EPackage>
File moved
<?xml version="1.0" encoding="ASCII"?>
<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0">
<application name="app">
<components xsi:type="app:SoftwareComponent" name="nginx">
<annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/>
</components>
</application>
<infrastructure name="infra">
<nodes xsi:type="infra:AutoScalingGroup" name="ag" deploymentNetwork="//@infrastructure/@networks.0">
<machineDefinition name="vm1" credentials="//@infrastructure/@credentials.0" group="//@infrastructure/@groups.0" generatedFrom="//@infrastructure/@generators.0">
<ifaces name="i1" endPoint="10.0.0.1" belongsTo="//@infrastructure/@networks.0" associated="//@infrastructure/@groups.0"/>
<location region="eu-central-1"/>
</machineDefinition>
</nodes>
<networks name="vpc" protocol="tcp/ip" addressRange="10.0.0.0/24" connectedIfaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0">
<subnets name="vpc_subnet" protocol="tcp/ip" addressRange="10.0.0.0/24"/>
</networks>
<generators xsi:type="infra:VMImage" name="vm_img" uri="ami-xxxxxxxxxxxxxxxxx" kind="IMAGE" generatedVMs="//@infrastructure/@nodes.0/@machineDefinition"/>
<credentials xsi:type="infra:KeyPair" name="ssh_key" user="ec2-user" keyfile="/tmp/ssh_key_file" algorithm="RSA" bits="4096"/>
<groups xsi:type="infra:SecurityGroup" name="sg" groupedNodes="//@infrastructure/@nodes.0/@machineDefinition" ifaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0">
<rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22">
<cidr>0.0.0.0/0</cidr>
</rules>
</groups>
</infrastructure>
<concretizations name="con_infra">
<providers name="aws">
<vms name="ec2_vm" maps="//@infrastructure/@nodes.0/@machineDefinition">
<annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/>
<annotations xsi:type="commons:SProperty" key="ssh_key_name" value="demo-key"/>
<annotations xsi:type="commons:SProperty" key="ec2_role_name" value="demo-ec2-role"/>
</vms>
<vmImages name="concrete_vm_image" maps="//@infrastructure/@generators.0"/>
<networks name="concrete_net" maps="//@infrastructure/@networks.0"/>
</providers>
</concretizations>
<optimization name="opt">
<objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/>
<objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/>
<objectives xsi:type="optimization:MeasurableObjective" kind="max" property="performance"/>
<nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost &lt;= 200" property="cost" max="200.0"/>
<nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="Availability >= 98%" property="availability" min="98.0"/>
<nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req3" description="Region" property="region">
<values>00EU</values>
</nonfunctionalRequirements>
<nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req4" description="Provider" property="provider">
<values>AMAZ</values>
</nonfunctionalRequirements>
</optimization>
<configurations name="config">
<deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0/@machineDefinition"/>
</configurations>
</commons:DOMLModel>
<?xml version="1.0" encoding="ASCII"?>
<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0">
<application name="app">
<components xsi:type="app:SoftwareComponent" name="nginx">
<annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/>
</components>
</application>
<infrastructure name="infra">
<nodes xsi:type="infra:AutoScalingGroup" name="ag" deploymentNetwork="//@infrastructure/@networks.0">
<machineDefinition name="vm1" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0" group="//@infrastructure/@groups.0" generatedFrom="//@infrastructure/@generators.0">
<ifaces name="i1" endPoint="16.0.0.1" belongsTo="//@infrastructure/@networks.0" associated="//@infrastructure/@groups.0"/>
</machineDefinition>
</nodes>
<networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/24" connectedIfaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0"/>
<generators xsi:type="infra:VMImage" name="v_img" generatedVMs="//@infrastructure/@nodes.0/@machineDefinition"/>
<credentials xsi:type="infra:KeyPair" name="ssh_key" user="ubuntu" keyfile="/home/user1/.ssh/openstack.key" algorithm="RSA" bits="4096"/>
<groups xsi:type="infra:SecurityGroup" name="sg" groupedNodes="//@infrastructure/@nodes.0/@machineDefinition" ifaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0">
<rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443">
<cidr>0.0.0.0/0</cidr>
</rules>
<rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22">
<cidr>0.0.0.0/0</cidr>
</rules>
</groups>
</infrastructure>
<concretizations name="con_infra">
<providers name="openstack">
<vms name="concrete_vm" maps="//@infrastructure/@nodes.0/@machineDefinition">
<annotations xsi:type="commons:SProperty" key="vm_name" value="nginx-host"/>
<annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/>
<annotations xsi:type="commons:SProperty" key="vm_key_name" value="user1"/>
</vms>
<vmImages name="concrete_vm_image" maps="//@infrastructure/@generators.0">
<annotations xsi:type="commons:SProperty" key="name" value="ubuntu-20.04.3"/>
</vmImages>
<networks name="concrete_net" maps="//@infrastructure/@networks.0">
<annotations xsi:type="commons:SProperty" key="name" value="ostack2"/>
</networks>
</providers>
</concretizations>
<optimization name="opt">
<objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/>
<nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost &lt;= 200" property="cost" max="200.0"/>
<nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider">
<values>OPEN</values>
</nonfunctionalRequirements>
</optimization>
<configurations name="config">
<deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0/@machineDefinition"/>
</configurations>
</commons:DOMLModel>
...@@ -3,12 +3,57 @@ ...@@ -3,12 +3,57 @@
"steps": [ "steps": [
{ {
"data": { "data": {
"computingGroup": [
{
"http": {
"cidr": [
"0.0.0.0/0"
],
"fromPort": 80,
"kind": "INGRESS",
"name": "http",
"protocol": "tcp",
"toPort": 80
},
"https": {
"cidr": [
"0.0.0.0/0"
],
"fromPort": 443,
"kind": "INGRESS",
"name": "https",
"protocol": "tcp",
"toPort": 443
},
"icmp": {
"cidr": [
"0.0.0.0/0"
],
"fromPort": -1,
"kind": "EGRESS",
"name": "icmp",
"protocol": "icmp",
"toPort": -1
},
"infra_element_name": "sg",
"ssh": {
"cidr": [
"0.0.0.0/0"
],
"fromPort": 22,
"kind": "INGRESS",
"name": "ssh",
"protocol": "tcp",
"toPort": 22
}
}
],
"credentials": [ "credentials": [
{ {
"algorithm": "RSA", "algorithm": "RSA",
"bits": 4096, "bits": 4096,
"infra_element_name": "ssh_key",
"keyfile": "/home/user1/.ssh/openstack.key", "keyfile": "/home/user1/.ssh/openstack.key",
"name": "ssh_key",
"user": "ubuntu" "user": "ubuntu"
} }
], ],
......
...@@ -14,9 +14,9 @@ logging.getLogger().setLevel(logging.INFO) ...@@ -14,9 +14,9 @@ logging.getLogger().setLevel(logging.INFO)
# Parse parameters # Parse parameters
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
skip_next = False skip_next = False
doml_directory = "./doml" doml_directory = "./icgparser/doml"
model_filename = "./nginx-openstack_v2_multiecores.domlx" model_filename = "icgparser/doml/v1/nginx-aws_v1.domlx"
load_split_model = True load_split_model = False
output_file_name = "iac_files.tar.gz" output_file_name = "iac_files.tar.gz"
......
...@@ -10,10 +10,10 @@ required_version = ">= 0.14.0" ...@@ -10,10 +10,10 @@ required_version = ">= 0.14.0"
# Configure the OpenStack Provider # Configure the OpenStack Provider
provider "openstack" { provider "openstack" {
user_name = var.openstack_username #user_name = var.openstack_username
tenant_name = "admin" #tenant_name = "admin"
password = var.openstack_password #password = var.openstack_password
auth_url = var.openstack_auth_url #auth_url = var.openstack_auth_url
insecure = true insecure = true
} }
...@@ -39,6 +39,23 @@ resource "openstack_compute_instance_v2" "vm1" { ...@@ -39,6 +39,23 @@ resource "openstack_compute_instance_v2" "vm1" {
network { network {
port = openstack_networking_port_v2.net1.id port = openstack_networking_port_v2.net1.id
} }
## AGENTS TO ADD
# this is subject to be moved to IEM as part of its baseline
provisioner "local-exec" {
command = "ansible-galaxy collection install community.general"
}
# this is subject to be moved to IEM as part of its baseline
provisioner "local-exec" {
command = "ansible-playbook ansible/playbooks/pma/site_requirements.yaml"
}
# secrets can be taken from environment variables at IEM but these security issues I will leave them to y2, the user can also be problematic ubuntu/root/centos/...
provisioner "local-exec" {
command = "ansible-playbook -u root -i '${openstack_networking_floatingip_v2.vm1_floating_ip_association.address},' ansible/playbooks/pma/site.yaml --extra-vars '{\"pma_deployment_id\": \"123e4567-e89b-12d3-a456-426614174002\", \"pma_influxdb_bucket\": \"bucket\", \"pma_influxdb_token\": \"piacerePassword\", \"pma_influxdb_org\": \"piacere\", \"pma_influxdb_addr\": \"https://influxdb.pm.ci.piacere.digital.tecnalia.dev\" }'"
}
} }
# Create ssh keys # Create ssh keys
...@@ -98,3 +115,50 @@ resource "openstack_networking_router_interface_v2" "net1_router_interface" { ...@@ -98,3 +115,50 @@ resource "openstack_networking_router_interface_v2" "net1_router_interface" {
subnet_id = openstack_networking_subnet_v2.net1_subnet.id subnet_id = openstack_networking_subnet_v2.net1_subnet.id
} }
# CREATING SECURITY_GROUP
resource "openstack_compute_secgroup_v2" "icmp" {
name = "icmp"
description = "Security group rule for port -1"
rule {
from_port = -1
to_port = -1
ip_protocol = "icmp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "http" {
name = "http"
description = "Security group rule for port 80"
rule {
from_port = 80
to_port = 80
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "https" {
name = "https"
description = "Security group rule for port 443"
rule {
from_port = 443
to_port = 443
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "ssh" {
name = "ssh"
description = "Security group rule for port 22"
rule {
from_port = 22
to_port = 22
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
}
resource "openstack_compute_secgroup_v2" "{{ name }}" { # CREATING SECURITY_GROUP
name = "{{ name }}" {% for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %}
description = "Security group rule for port {{ fromPort }}" resource "openstack_compute_secgroup_v2" "{{ key }}" {
name = "{{ key }}"
description = "Security group rule for port {{ value.fromPort }}"
rule { rule {
from_port = {{ fromPort }} from_port = {{ value.fromPort }}
to_port = {{ toPort }} to_port = {{ value.toPort }}
ip_protocol = "{{ protocol }}" ip_protocol = "{{ value.protocol }}"
cidr = {% for range in cidr %}"{{ range }}"{% endfor %} cidr = {% for range in value.cidr %}"{{ range }}"{% endfor %}
} }
} }
{% endif %}{% endif %}{% endfor %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment