Resource Definition
This section explains how to define an Amorphic resource as code using a JSON file.
You can find sample resource definitions here Resource Templates
Logical Resource ID
Each resource is identified by a logical ID, which serves as the root key in the JSON file. This ID is used internally by the CICD module to uniquely identify each resource and has no relation to the actual resource name created in Amorphic. You can assign any logical name, but it must be unique within the project.
Basic Resource Structure
Every resource definition requires two primary keys:
- Type: Specifies the type of the resource. It must be one of the resource types supported by the CICD Utils module.
- Properties: Contains all the details needed to create the resource in Amorphic. Required property keys can be referenced from the API documentation or observed from the API calls made by the Amorphic UI.
Example: Domain Resource
{
"rDomain": {
"Type": "Domain",
"Properties": {
"DomainName": "states",
"DisplayName": "States",
"DomainDescription": "Domain representing states",
"TenantName": "cadp"
}
}
}
Resources with Artifacts
Some resources, such as ETL Jobs, require additional artifacts like job scripts. These should be specified under an Artifacts section within the resource definition. All artifact paths must be relative to the root resources directory.
Example: Job Resource with Script
{
"rPythonJob": {
"Type": "Job",
"Artifacts": {
"Script": "resources/jobs/pythonjob/job_script.py"
},
"Properties": {
"JobName": "pythonshelljob",
"Description": "Python shell Job created from CICD",
"ETLJobType": "pythonshell",
"NetworkConfiguration": "general-public-network",
"JobBookmarkOption": "disable",
"Keywords": ["Owner: john"],
"MaxCapacity": 0.0625,
"ParameterAccess": [],
"SharedLibraries": [],
"DomainAccess": { "Owner": [], "ReadOnly": [] },
"DatasetAccess": {
"Owner": [],
"ReadOnly": []
},
"DefaultArguments": { "max_read": "10" },
"IsDataLineageEnabled": "no",
"IsAutoScalingEnabled": false
}
}
}
- All asset paths must be relative to the root
resourcesdirectory to ensure correct deployment. - For more information about supported artifacts and property keys for each resource type, refer to the corresponding CICD resource documentation.