-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put providers.tf & required_providers.tf to each app folder
- Loading branch information
Showing
6 changed files
with
119 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module TerraformConfig | ||
class Provider < Base | ||
attr_reader :name, :options | ||
|
||
def initialize(name, **options) | ||
super() | ||
|
||
@name = name | ||
@options = options | ||
end | ||
|
||
def to_tf | ||
block :provider, name do | ||
options.each do |option, value| | ||
argument option, value | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe TerraformConfig::Provider do | ||
let(:config) { described_class.new(name, **options) } | ||
|
||
describe "#to_tf" do | ||
subject(:generated) { config.to_tf } | ||
|
||
context "when provider is cpln" do | ||
let(:name) { "cpln" } | ||
let(:options) { { org: "test-org" } } | ||
|
||
it "generates correct config" do | ||
expect(generated).to eq( | ||
<<~EXPECTED | ||
provider "cpln" { | ||
org = "test-org" | ||
} | ||
EXPECTED | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters