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

[breaking] make aws provider optional #247

Merged
merged 8 commits into from
May 16, 2019
Merged

Conversation

ryanking
Copy link
Contributor

@ryanking ryanking commented May 15, 2019

Summary

This change makes it optional to specify an aws provider. Only planning on supporting this for config
v2 but it might accidentally work in v1.

The only breaking change is that we now require an aws account id for the global component, where before we would silently ignore the fact that it was missing. I consider this a bug / oversight so fixing it here.

Test Plan

This diff adds a number of tests, especially golden file tests. None of the existing golden files had to be changed.

References

ryanking added 5 commits May 15, 2019 10:07
This change makes it optional to specify an aws provider. Only planning on supporting this for config
v2 but it might work in v1 for some cases.

The only breaking change is that we now require an aws account id for the global component, where before
we would silently ignore the fact that it was missing.
@ryanking ryanking requested a review from a team as a code owner May 15, 2019 23:33
@codecov
Copy link

codecov bot commented May 15, 2019

Codecov Report

Merging #247 into master will increase coverage by 0.04%.
The diff coverage is 93.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
+ Coverage   79.07%   79.12%   +0.04%     
==========================================
  Files          15       16       +1     
  Lines        1214     1236      +22     
==========================================
+ Hits          960      978      +18     
- Misses        147      150       +3     
- Partials      107      108       +1
Impacted Files Coverage Δ
config/v2/config.go 100% <100%> (ø) ⬆️
config/v2/validation.go 81.81% <80.64%> (-8.51%) ⬇️
plan/plan.go 91.08% <89.47%> (-1.03%) ⬇️
config/v2/resolvers.go 98.03% <98.03%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c1ce9b...7a40634. Read the comment docs.

@@ -218,9 +219,9 @@ func TestCreateFileNonExistentDirectory(t *testing.T) {
}

func TestApplySmokeTest(t *testing.T) {
a := assert.New(t)
r := require.New(t)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require fails fast, while assert keeps going

@@ -231,6 +232,7 @@ func TestApplySmokeTest(t *testing.T) {
"aws_profile_provider": "prof",
"aws_profile_backend": "prof",
"aws_provider_version": "0.12.0",
"account_id": 789,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You now need to specify an account_id for global

@@ -0,0 +1,188 @@
package v2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is mostly just moved code from v2/validations.go


// ResolveAWSProvider will return an AWSProvder iff one of the required fields is set somewhere in the set of Common
// config objects passed in. Otherwise it will return nil.
func ResolveAWSProvider(commons ...Common) *AWSProvider {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is new tho

@@ -10,14 +10,14 @@
}

# Aliased Providers (for doing things in every region).
{{ $out := . }}
{{ $outter := . }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying to make it clearer that we are capturing the outer scope

../../../terraform.d
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bug, fixed now. unfortunately our tests don't catch this because we don't do any assertions on links

@czimergebot czimergebot merged commit 876ec2a into master May 16, 2019
@edulop91 edulop91 removed their assignment May 16, 2019
@edulop91 edulop91 deleted the ryanking/optional_aws branch May 16, 2019 20:08
palasha pushed a commit to palasha/fogg that referenced this pull request Apr 7, 2020
[breaking] make aws provider optional### Summary
This change makes it optional to specify an aws provider. Only planning on supporting this for config
v2 but it might accidentally work in v1.

The only breaking change is that we now require an aws account id for the global component, where before we would silently ignore the fact that it was missing. I consider this a bug / oversight so fixing it here.

### Test Plan

This diff adds a number of tests, especially golden file tests. None of the existing golden files had to be changed.

### References

*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants