Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the use of the FIPS endpoint for the S3_file resource and update the create_aws_interface method to support this functionality #490

Merged
merged 6 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the aws cookbook.

## Unreleased

- Enable the use of the FIPS endpoint for the `S3_file` resource and update the `create_aws_interface` method to support this functionality

## 9.1.7 - *2024-07-10*

Standardise files with files in sous-chefs/repo-management
Expand Down Expand Up @@ -647,7 +649,6 @@ Update checkout to v3 in ci.yml
[@bazbremner]: https://github.com/bazbremner
[@dhui]: https://github.com/dhui
[@drmerlin]: https://github.com/DrMerlin
[@drywheat]: https://github.com/drywheat
[@knorby]: https://github.com/knorby
[@miketheman]: https://github.com/miketheman
[@mkantor]: https://github.com/mkantor
Expand Down
4 changes: 3 additions & 1 deletion libraries/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def fallback_region

# setup AWS instance using passed creds, iam profile, or assumed role
def create_aws_interface(aws_interface, **opts)
use_fips_endpoint = opts.key?(:use_fips_endpoint) ? opts[:use_fips_endpoint] : false
aws_interface_opts = { region: opts[:region],
http_proxy: ENV['http_proxy'] }
http_proxy: ENV['http_proxy'],
use_fips_endpoint: use_fips_endpoint }

if opts[:mock] # return a mocked interface
aws_interface_opts[:stub_responses] = true
Expand Down
3 changes: 2 additions & 1 deletion resources/s3_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
property :manage_symlink_source, [true, false]
property :virtual_host, [true, false], default: false
property :s3_url, String
property :use_fips_endpoint, [true, false], default: false
# Intentionally not using platform_family?('windows') due to a bug/issue
# where this method is not abvailable in the context of gating properties
# TODO: update when this is fixed
Expand Down Expand Up @@ -60,7 +61,7 @@ def s3
require 'aws-sdk-s3'

Chef::Log.debug('Initializing the S3 Client')
@s3 ||= create_aws_interface(::Aws::S3::Client, region: new_resource.region)
@s3 ||= create_aws_interface(::Aws::S3::Client, region: new_resource.region, use_fips_endpoint: new_resource.use_fips_endpoint)
end

def s3_obj
Expand Down
Loading