emory-libraries/dlp-selfdeposit

View on GitHub
ansible/files/fedora-depo-s3.yaml

Summary

Maintainability
Test Coverage
AWSTemplateFormatVersion: 2010-09-09
Parameters:
  EnvironmentParameter:
    Type: String
  BackupParameter:
    Type: String
Conditions: 
  IsBackup: !Equals 
    - !Ref BackupParameter
    - 'true'
  NotBackup: !Equals
    - !Ref BackupParameter
    - 'false'
Resources:
  FedoraDepoS3:
    Type: 'AWS::S3::Bucket'
    Condition: NotBackup
    Properties:
      BucketName: !Sub 'fedora-depo-${EnvironmentParameter}-binaries'
      VersioningConfiguration:
        Status: Enabled
      PublicAccessBlockConfiguration:
        BlockPublicAcls: false
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true
      ReplicationConfiguration:
        Role: arn:aws:iam::556359784184:role/replicationrole
        Rules: 
          - Destination: 
              Bucket: !Sub 'arn:aws:s3:::backup-fedora-depo-${EnvironmentParameter}-binaries'
            Status: Enabled
  FedoraDepoS3Backup:
    Type: 'AWS::S3::Bucket'
    Condition: IsBackup
    Properties:
      BucketName: !Sub 'backup-fedora-depo-${EnvironmentParameter}-binaries'
      VersioningConfiguration:
        Status: Enabled