Package com.cloudforge.core.config
Class DeploymentConfig
java.lang.Object
com.cloudforge.core.config.DeploymentConfig
Universal deployment configuration for CloudForge applications.
This is the canonical configuration structure used by both interactive deployers and non-interactive deployment tools. It maps directly to deployment-context.json and can be serialized/deserialized via Jackson.
Architecture: This class lives in cloudforge-core (the contract layer) as it defines the data model interface between libraries and consumers. This ensures cfc-testing and other consumers always use the latest configuration schema without duplication.
- Since:
- CloudForge 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionEnable ALB access logs to S3Enable anti-malware scanningApplication identifier (e.g., "jenkins", "gitlab", "vault")Human-readable application nameApplicationSpec instance (not serialized to JSON)S3 bucket for artifactsS3 prefix for artifactsEnable AWS Audit ManagerAuthentication modeEnable automated backups (null = use security profile default)Auto-provision SAML application in IAM Identity CenterString[]Availability zones for deploymentEnable AWS ConfigCIDR for bastion/VPN SSH accessCertificate expiration monitoring enabledEnable CloudFront CDNEnable CloudTrail for API audit loggingEnable CloudTrail InsightsEnable CloudWatch Logs KMS encryptionAdmin group nameExisting Cognito App Client IDAuto-provision new Cognito User PoolCreate admin and user groups in CognitoCognito domain prefix (must be globally unique)Initial admin email addressInitial admin phone number (E.164 format)Enable MFA for CognitoCognito MFA methodUser group nameExisting Cognito User Pool IDCognito User Pool nameCompliance frameworks to enable.Compliance validation mode controlling how validation failures are handled.Override container image tagEnable container image vulnerability scanningEnable container runtime security monitoringintFargate CPU units (256, 512, 1024, 2048, 4096)intCPU target utilization percentage for auto-scalingCreate AWS Config infrastructureCreate GuardDuty detector (account-region singleton)Create Route53 hosted zoneEnable cross-region backups (null = use security profile default)Allocated storage in GB.Backup retention period in days.Database engine (e.g., postgres, mysql, mariadb).RDS instance class (e.g., db.t3.small, db.m5.large).Enable Multi-AZ deployment for high availability.Database name.Database engine version.Primary domain (e.g., "example.com")Enable EFS encryption in transitbooleanEnable JNLP build agent port (Jenkins: 50000)Enable auto-scalingEnable CloudTrail bucket access logging remediationbooleanEnable Redis Cluster bus port (Redis: 16379)booleanEnable clustering ports (Mattermost: 8074-8075, Vault: 8201)booleanEnable container registry port (GitLab: 5050, Nexus: 5000-5002)Enable encryption at restEnable VPC flow logsbooleanEnable Prometheus metrics port (GitLab: 9090)Enable CloudWatch monitoringbooleanEnable Notary content trust port (Harbor: 4443)Enable RDS auto minor version upgrade remediationEnable RDS deletion protection remediationEnable S3 versioning remediationbooleanEnable Redis Sentinel port (Redis: 26379)booleanEnable SMTP email port (Mattermost: 587)booleanEnable SMTP TLS email port (Mattermost: 465)booleanEnable Git SSH port (GitLab: 22, Gitea: 2222)Enable SSL certificate via ACMbooleanEnable Trivy vulnerability scanner port (Harbor: 8080)Environment name (e.g., "dev", "staging", "production")Reuse existing EFS by ID (for disaster recovery workflows)Enable file integrity monitoringFully qualified domain name (computed from domain+subdomain if not provided)GDPR data transfer approval flag for non-EU deployments.GuardDuty alerts configured (EventBridge to SNS/SIEM)Enable GuardDuty threat detectionintintintintHTTPS-only mode (no HTTP listener when SSL enabled)Identity Center group name for user assignmentEnable Amazon Inspector for vulnerability scanningEC2 instance type (e.g., "t3.micro", "t3.small")Load balancer typeCloudWatch Logs retention daysEnable Macie automated discovery jobsEnable Amazon Macie for PII/PHI discovery (HIPAA/GDPR)intMaximum instance capacity for auto-scalingintFargate memory in MBintMinimum instance capacity for auto-scalingNetwork mode for VPC topologyOIDC authorization endpointOIDC client IDOIDC client secret name in Secrets ManagerOIDC issuer URLOIDC provider (none, cognito, identity-center, external-idp)OIDC token endpointOIDC user info endpointProvision RDS database for application.AWS region (e.g., "us-east-1", "us-west-2")Restrict security group egress to VPC CIDR only (requires VPC endpoints for AWS service access)Retain EFS/EBS volumes on stack deletionEnable Route53 Query LoggingRuntime type (FARGATE or EC2)Enable S3 Object Lock for audit buckets (HIPAA/PCI-DSS immutability requirement)Enable AWS Security Hub for centralized security findingsEnable security monitoringSecurity profile (DEV, STAGING, PRODUCTION)SSO Group IDIAM Identity Center (SSO) Instance ARNSSO Target Account IDCloudFormation stack nameSubdomain prefix (e.g., "ci", "gitlab")Topology type (APPLICATION_SERVICE, etc.)intEnable AWS WAF -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DeploymentConfigLoad DeploymentConfig from a JSON file path string.static DeploymentConfigLoad DeploymentConfig from a JSON file (e.g., deployment-context.json).static DeploymentConfigLoad DeploymentConfig from a JSON string.static DeploymentConfigLoad DeploymentConfig from a Map (e.g., CDK context).Returns the compliance frameworks as a comma-separated string.booleanChecks if any compliance framework is enabled.booleanhasComplianceFramework(ComplianceFrameworkType framework) Checks if a specific compliance framework is enabled.Convert this DeploymentConfig to a Map for CDK context.voidSave this DeploymentConfig to a JSON file path string.voidSave this DeploymentConfig to a JSON file.toJson()Serialize this DeploymentConfig to a JSON string.
-
Field Details
-
stackName
CloudFormation stack name -
environment
Environment name (e.g., "dev", "staging", "production") -
applicationId
Application identifier (e.g., "jenkins", "gitlab", "vault") -
applicationName
Human-readable application name -
applicationSpec
ApplicationSpec instance (not serialized to JSON) -
domain
Primary domain (e.g., "example.com") -
subdomain
Subdomain prefix (e.g., "ci", "gitlab") -
fqdn
Fully qualified domain name (computed from domain+subdomain if not provided) -
enableSsl
Enable SSL certificate via ACM -
runtime
Runtime type (FARGATE or EC2) -
topology
Topology type (APPLICATION_SERVICE, etc.) -
securityProfile
Security profile (DEV, STAGING, PRODUCTION) -
networkMode
Network mode for VPC topology -
lbType
Load balancer type -
createZone
Create Route53 hosted zone -
enableFlowlogs
Enable VPC flow logs -
wafEnabled
Enable AWS WAF -
httpsStrictEnabled
HTTPS-only mode (no HTTP listener when SSL enabled) -
albAccessLogging
Enable ALB access logs to S3 -
cloudfrontEnabled
Enable CloudFront CDN -
bastionCidr
CIDR for bastion/VPN SSH access -
minInstanceCapacity
public int minInstanceCapacityMinimum instance capacity for auto-scaling -
maxInstanceCapacity
public int maxInstanceCapacityMaximum instance capacity for auto-scaling -
cpuTargetUtilization
public int cpuTargetUtilizationCPU target utilization percentage for auto-scaling -
cpu
public int cpuFargate CPU units (256, 512, 1024, 2048, 4096) -
memory
public int memoryFargate memory in MB -
instanceType
EC2 instance type (e.g., "t3.micro", "t3.small") -
containerImage
Override container image tag -
retainStorage
Retain EFS/EBS volumes on stack deletion -
existingFileSystemId
Reuse existing EFS by ID (for disaster recovery workflows) -
artifactsBucket
S3 bucket for artifacts -
artifactsPrefix
S3 prefix for artifacts -
authMode
Authentication mode -
oidcProvider
OIDC provider (none, cognito, identity-center, external-idp) -
cognitoAutoProvision
Auto-provision new Cognito User Pool -
cognitoUserPoolName
Cognito User Pool name -
cognitoDomainPrefix
Cognito domain prefix (must be globally unique) -
cognitoMfaEnabled
Enable MFA for Cognito -
cognitoMfaMethod
Cognito MFA method -
cognitoCreateGroups
Create admin and user groups in Cognito -
cognitoAdminGroupName
Admin group name -
cognitoUserGroupName
User group name -
cognitoInitialAdminEmail
Initial admin email address -
cognitoInitialAdminPhone
Initial admin phone number (E.164 format) -
cognitoUserPoolId
Existing Cognito User Pool ID -
cognitoAppClientId
Existing Cognito App Client ID -
oidcIssuer
OIDC issuer URL -
oidcAuthorizationEndpoint
OIDC authorization endpoint -
oidcTokenEndpoint
OIDC token endpoint -
oidcUserInfoEndpoint
OIDC user info endpoint -
oidcClientId
OIDC client ID -
oidcClientSecretName
OIDC client secret name in Secrets Manager -
enableAgents
public boolean enableAgentsEnable JNLP build agent port (Jenkins: 50000) -
enableSsh
public boolean enableSshEnable Git SSH port (GitLab: 22, Gitea: 2222) -
enableSmtp
public boolean enableSmtpEnable SMTP email port (Mattermost: 587) -
enableSmtps
public boolean enableSmtpsEnable SMTP TLS email port (Mattermost: 465) -
enableClustering
public boolean enableClusteringEnable clustering ports (Mattermost: 8074-8075, Vault: 8201) -
enableDockerRegistry
public boolean enableDockerRegistryEnable container registry port (GitLab: 5050, Nexus: 5000-5002) -
enableMetrics
public boolean enableMetricsEnable Prometheus metrics port (GitLab: 9090) -
enableNotary
public boolean enableNotaryEnable Notary content trust port (Harbor: 4443) -
enableTrivy
public boolean enableTrivyEnable Trivy vulnerability scanner port (Harbor: 8080) -
enableSentinel
public boolean enableSentinelEnable Redis Sentinel port (Redis: 26379) -
enableCluster
public boolean enableClusterEnable Redis Cluster bus port (Redis: 16379) -
autoProvisionIdentityCenter
Auto-provision SAML application in IAM Identity Center -
ssoInstanceArn
IAM Identity Center (SSO) Instance ARN -
ssoGroupId
SSO Group ID -
ssoTargetAccountId
SSO Target Account ID -
identityCenterGroupName
Identity Center group name for user assignment -
provisionDatabase
Provision RDS database for application. Only shown for applications with optional database support (e.g., Metabase, Grafana). Applications requiring database (e.g., Mattermost, GitLab) always provision one. -
databaseEngine
Database engine (e.g., postgres, mysql, mariadb). Default comes from ApplicationSpec.databaseRequirement().engine() -
databaseVersion
Database engine version. Default comes from ApplicationSpec.databaseRequirement().version() -
databaseInstanceClass
RDS instance class (e.g., db.t3.small, db.m5.large). DESTRUCTIVE: Changing this requires resource replacement. BILLING_IMPACT: Larger instances cost more. -
databaseAllocatedStorageGB
Allocated storage in GB. BILLING_IMPACT: More storage costs more. -
databaseMultiAz
Enable Multi-AZ deployment for high availability. BILLING_IMPACT: Multi-AZ doubles database costs. -
databaseName
Database name. IMMUTABLE: Cannot be changed after creation. -
databaseBackupRetentionDays
Backup retention period in days. Compliance frameworks may override: PCI-DSS (90 days), HIPAA (30 days), SOC2 (14 days). -
enableRdsDeletionProtectionRemediation
Enable RDS deletion protection remediation -
enableRdsAutoMinorVersionUpgradeRemediation
Enable RDS auto minor version upgrade remediation -
complianceFrameworks
Compliance frameworks to enable.Supports comma-separated string format in JSON for backward compatibility:
{"complianceFrameworks": "soc2,pci-dss,hipaa"}In Java code, use the type-safe List:
config.complianceFrameworks.contains(ComplianceFrameworkType.HIPAA)
-
complianceMode
Compliance validation mode controlling how validation failures are handled. -
logRetentionDays
CloudWatch Logs retention days -
enableMonitoring
Enable CloudWatch monitoring -
enableEncryption
Enable encryption at rest -
awsConfigEnabled
Enable AWS Config -
createConfigInfrastructure
Create AWS Config infrastructure -
guardDutyEnabled
Enable GuardDuty threat detection -
createGuardDutyDetector
Create GuardDuty detector (account-region singleton) -
guardDutyAlertsConfigured
GuardDuty alerts configured (EventBridge to SNS/SIEM) -
certificateExpirationMonitoring
Certificate expiration monitoring enabled -
cloudTrailEnabled
Enable CloudTrail for API audit logging -
securityMonitoringEnabled
Enable security monitoring -
efsEncryptionInTransitEnabled
Enable EFS encryption in transit -
restrictSecurityGroupEgress
Restrict security group egress to VPC CIDR only (requires VPC endpoints for AWS service access) -
automatedBackupEnabled
Enable automated backups (null = use security profile default) -
crossRegionBackupEnabled
Enable cross-region backups (null = use security profile default) -
macieEnabled
Enable Amazon Macie for PII/PHI discovery (HIPAA/GDPR) -
macieAutomatedDiscovery
Enable Macie automated discovery jobs -
securityHubEnabled
Enable AWS Security Hub for centralized security findings -
inspectorEnabled
Enable Amazon Inspector for vulnerability scanning -
antiMalwareEnabled
Enable anti-malware scanning -
fileIntegrityMonitoring
Enable file integrity monitoring -
containerRuntimeSecurity
Enable container runtime security monitoring -
containerImageScanning
Enable container image vulnerability scanning -
auditManagerEnabled
Enable AWS Audit Manager -
cloudWatchLogsKmsEncryptionEnabled
Enable CloudWatch Logs KMS encryption -
cloudTrailInsightsEnabled
Enable CloudTrail Insights -
route53QueryLoggingEnabled
Enable Route53 Query Logging -
s3ObjectLockEnabled
Enable S3 Object Lock for audit buckets (HIPAA/PCI-DSS immutability requirement) -
enableS3VersioningRemediation
Enable S3 versioning remediation -
enableCloudTrailBucketAccessRemediation
Enable CloudTrail bucket access logging remediation -
healthCheckGracePeriod
public int healthCheckGracePeriod -
healthCheckInterval
public int healthCheckInterval -
healthCheckTimeout
public int healthCheckTimeout -
healthyThreshold
public int healthyThreshold -
unhealthyThreshold
public int unhealthyThreshold -
region
AWS region (e.g., "us-east-1", "us-west-2") -
gdprDataTransferApproved
GDPR data transfer approval flag for non-EU deployments. -
availabilityZones
Availability zones for deployment -
enableAutoScaling
Enable auto-scaling
-
-
Constructor Details
-
DeploymentConfig
public DeploymentConfig()
-
-
Method Details
-
fromFile
Load DeploymentConfig from a JSON file (e.g., deployment-context.json).- Parameters:
path- Path to the JSON file- Returns:
- DeploymentConfig populated from JSON
- Throws:
IOException- if file cannot be read or parsed
-
fromFile
Load DeploymentConfig from a JSON file path string.- Parameters:
filePath- Path to the JSON file- Returns:
- DeploymentConfig populated from JSON
- Throws:
IOException- if file cannot be read or parsed
-
fromJson
public static DeploymentConfig fromJson(String json) throws com.fasterxml.jackson.core.JsonProcessingException Load DeploymentConfig from a JSON string.- Parameters:
json- JSON string- Returns:
- DeploymentConfig populated from JSON
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if JSON cannot be parsed
-
fromMap
Load DeploymentConfig from a Map (e.g., CDK context).Uses Jackson's type-safe conversion to handle:
- String → Enum conversion via @JsonCreator methods
- String/Number → Boolean conversion (supports "1", "yes", "0", "no")
- Comma-separated strings → List conversion (complianceFrameworks)
- Unknown properties are ignored for forward compatibility
- Parameters:
map- Map containing configuration key-value pairs- Returns:
- DeploymentConfig populated from the map
-
toJson
Serialize this DeploymentConfig to a JSON string.- Returns:
- JSON string representation
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- if serialization fails
-
toFile
Save this DeploymentConfig to a JSON file.- Parameters:
path- Path to write the JSON file- Throws:
IOException- if file cannot be written
-
toFile
Save this DeploymentConfig to a JSON file path string.- Parameters:
filePath- Path to write the JSON file- Throws:
IOException- if file cannot be written
-
getComplianceFrameworksAsString
Returns the compliance frameworks as a comma-separated string. Provided for backward compatibility with code expecting the old string format.- Returns:
- comma-separated framework string (e.g., "soc2,pci-dss,hipaa")
-
hasComplianceFramework
Checks if a specific compliance framework is enabled.- Parameters:
framework- the framework to check- Returns:
- true if the framework is in the list
-
hasAnyComplianceFramework
public boolean hasAnyComplianceFramework()Checks if any compliance framework is enabled.- Returns:
- true if at least one framework is configured
-
toContextMap
Convert this DeploymentConfig to a Map for CDK context.Special handling:
- Renames "environment" to "env" for CDK compatibility
- Excludes null values
- Returns:
- Map suitable for CDK App context
-