class GeoEngineer::Resources::AwsS3Bucket

AwsS3Bucket is the aws_s3_bucket terrform resource,

{www.terraform.io/docs/providers/aws/r/s3_bucket.html Terraform Docs}

Public Class Methods

_fetch_remote_resources(provider) click to toggle source
# File lib/geoengineer/resources/aws_s3_bucket.rb, line 46
def self._fetch_remote_resources(provider)
  AwsClients.s3(provider).list_buckets[:buckets].map(&:to_h).map do |s3b|
    s3b[:_terraform_id] = s3b[:name]
    s3b[:_geo_id] = s3b[:name]
    s3b[:bucket]  = s3b[:name]
    s3b
  end
end

Public Instance Methods

short_type() click to toggle source
# File lib/geoengineer/resources/aws_s3_bucket.rb, line 42
def short_type
  "s3"
end
to_terraform_state() click to toggle source
# File lib/geoengineer/resources/aws_s3_bucket.rb, line 32
def to_terraform_state
  tfstate = super
  tfstate[:primary][:attributes] = {
    'acl' => (acl || 'private'),
    'force_destroy' => (force_destroy || 'false'),
    'policy' => policy
  }
  tfstate
end
validate_policy_json() click to toggle source
# File lib/geoengineer/resources/aws_s3_bucket.rb, line 24
def validate_policy_json
  return unless policy
  JSON.parse(policy)
  return nil
rescue JSON::ParserError
  return "Error: policy #{for_resource} invalid JSON"
end