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

Add shell_sensitive_script data source and resource #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 shell/data_source_shell_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/rs/xid"
)

func dataSourceShellScript() *schema.Resource {
func dataSourceShellScript(sensitive_output bool) *schema.Resource {
return &schema.Resource{
Read: dataSourceShellScriptRead,

Expand Down Expand Up @@ -52,6 +52,7 @@ func dataSourceShellScript() *schema.Resource {
Type: schema.TypeMap,
Computed: true,
Elem: schema.TypeString,
Sensitive: sensitive_output,
},
},
}
Expand Down
6 changes: 4 additions & 2 deletions shell/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ func Provider() terraform.ResourceProvider {
},

DataSourcesMap: map[string]*schema.Resource{
"shell_script": dataSourceShellScript(),
"shell_script": dataSourceShellScript(false),
"shell_sensitive_script": dataSourceShellScript(true),
},

ResourcesMap: map[string]*schema.Resource{
"shell_script": resourceShellScript(),
"shell_script": resourceShellScript(false),
"shell_sensitive_script": resourceShellScript(true),
},
ConfigureFunc: providerConfigure,
}
Expand Down
2 changes: 2 additions & 0 deletions shell/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestProvider_impl(t *testing.T) {
func TestProvider_HasChildResources(t *testing.T) {
expectedResources := []string{
"shell_script",
"shell_sensitive_script",
}

resources := testAccProvider.ResourcesMap
Expand All @@ -47,6 +48,7 @@ func TestProvider_HasChildResources(t *testing.T) {
func TestProvider_HasChildDataSources(t *testing.T) {
expectedDataSources := []string{
"shell_script",
"shell_sensitive_script",
}

dataSources := testAccProvider.DataSourcesMap
Expand Down
3 changes: 2 additions & 1 deletion shell/resource_shell_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/rs/xid"
)

func resourceShellScript() *schema.Resource {
func resourceShellScript(sensitive_output bool) *schema.Resource {
return &schema.Resource{
Create: resourceShellScriptCreate,
Delete: resourceShellScriptDelete,
Expand Down Expand Up @@ -78,6 +78,7 @@ func resourceShellScript() *schema.Resource {
Type: schema.TypeMap,
Computed: true,
Elem: schema.TypeString,
Sensitive: sensitive_output,
},
"dirty": {
Type: schema.TypeBool,
Expand Down