| AWSTemplateFormatVersion: '2010-09-09' |
| Description: Deploy an EBS Volume for Gerrit service data. |
| Parameters: |
| GerritVolumeId: |
| Description: Existing Gerrit volume id |
| Type: String |
| Default: "" |
| GerritVolumeSnapshotId: |
| Description: Id of the EBS snapshot for Gerrit volume |
| Type: String |
| Default: "" |
| GerritVolumeSizeInGiB: |
| Description: Gerrit volume size in GiB |
| Type: Number |
| Default: 10 |
| AvailabilityZone: |
| Description: The Availability Zone in which to create the volume |
| Type: String |
| |
| Conditions: |
| CreateEBSVolume: !Equals [!Ref GerritVolumeId, ""] |
| CreateEBSVolumeBasedOnSnapshot: !Not |
| - !Equals [!Ref GerritVolumeSnapshotId, ""] |
| |
| Resources: |
| GerritVolume: |
| Condition: CreateEBSVolume |
| Type: AWS::EC2::Volume |
| Properties: |
| AvailabilityZone: !Ref AvailabilityZone |
| SnapshotId: !If [CreateEBSVolumeBasedOnSnapshot, !Ref GerritVolumeSnapshotId, !Ref "AWS::NoValue"] |
| Size: !If [CreateEBSVolumeBasedOnSnapshot, !Ref "AWS::NoValue", !Ref GerritVolumeSizeInGiB] |
| |
| Outputs: |
| GerritVolumeRef: |
| Value: !If [CreateEBSVolume, !Ref "GerritVolume", !Ref "GerritVolumeId"] |