class Convection::Model::Template::Resource::S3Bucket

@example

s3_bucket 'BucketWithSNSNotification' do
  bucket_name "my-bucket.blah.com"
  notification_configuration(
    'TopicConfigurations' => [
       {'Event' => 's3:ObjectCreated:*', 'Topic' => "arn:aws:sns:sns-topic-arn...."}
    ])
  with_output
end

Public Instance Methods

cors_configuration(&block) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 30
def cors_configuration(&block)
  config = ResourceProperty::S3CorsConfiguration.new(self)
  config.instance_exec(&block) if block
  properties['CorsConfiguration'].set(config)
end
cors_configurationm(*args) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 36
def cors_configurationm(*args)
  warn 'DEPRECATED: "cors_configurationm" is deprecated. Please use "cors_configuration" instead. https://github.com/rapid7/convection/pull/135'
  cors_configuration(*args)
end
render(*args) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 77
def render(*args)
  super.tap do |resource|
    render_tags(resource)
  end
end
replication_configuration(&block) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 41
def replication_configuration(&block)
  config = ResourceProperty::S3ReplicationConfiguration.new(self)
  config.instance_exec(&block) if block
  properties['ReplicationConfiguration'].set(config)
end
terraform_import_commands(module_path: 'root') click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 53
def terraform_import_commands(module_path: 'root')
  commands = ['# Run the following commands to import your infrastructure into terraform management.', '# ensure :module_path is set correctly', '']
  module_prefix = "#{module_path}." unless module_path == 'root'

  commands << '# Import s3 bucket and s3 bucket policy: '
  commands << "terraform import #{module_prefix}aws_s3_bucket.#{name.underscore} #{stack.resources[name].physical_resource_id}"
  commands << ''
  commands
end
to_hcl_json(*) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 63
def to_hcl_json(*)
  bucket_resource = {
    name.underscore => {
      bucket: stack.resources[name].physical_resource_id,
      acl: 'private',
      force_destroy: false
    }
  }

  data = [{ aws_region: { current: { current: true } } }]
  vars = [{ cloud: { description: 'The cloud name for this resource.' } }]
  { resource: [{ aws_s3_bucket: bucket_resource }], data: data, variable: vars }.to_json
end
website_configuration(&block) click to toggle source
# File lib/convection/model/template/resource/aws_s3_bucket.rb, line 47
def website_configuration(&block)
  config = ResourceProperty::S3WebsiteConfiguration.new(self)
  config.instance_exec(&block) if block
  properties['WebsiteConfiguration'].set(config)
end