Skip to content

Commit 80956dc

Browse files
authored
Merge pull request #215 from yossig-aquasec/integration_regigstry_missing_description
bug: missing description in aquasec_integration_registry.
2 parents 8a93fa5 + e1990e1 commit 80956dc

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

aquasec/data_registry.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func dataSourceRegistry() *schema.Resource {
3131
Description: "The name of the registry; string, required - this will be treated as the registry's ID, so choose a simple alphanumerical name without special signs and spaces",
3232
Required: true,
3333
},
34+
"description": {
35+
Type: schema.TypeString,
36+
Description: "The description of the registry",
37+
Computed: true,
38+
},
3439
"url": {
3540
Type: schema.TypeString,
3641
Description: "The URL, address or region of the registry",
@@ -122,6 +127,7 @@ func dataRegistryRead(d *schema.ResourceData, m interface{}) error {
122127
d.Set("username", reg.Username)
123128
d.Set("password", reg.Password)
124129
d.Set("name", reg.Name)
130+
d.Set("description", reg.Description)
125131
d.Set("type", reg.Type)
126132
d.Set("url", reg.URL)
127133
d.Set("auto_pull", reg.AutoPull)

aquasec/resource_registry.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ func resourceRegistry() *schema.Resource {
2424
Optional: true,
2525
Computed: true,
2626
},
27+
"description": {
28+
Type: schema.TypeString,
29+
Description: "The description of the registry",
30+
Optional: true,
31+
},
2732
"author": {
2833
Type: schema.TypeString,
2934
Description: "The username of the user who created or last modified the registry",
@@ -176,6 +181,7 @@ func resourceRegistryCreate(d *schema.ResourceData, m interface{}) error {
176181
Username: d.Get("username").(string),
177182
Password: d.Get("password").(string),
178183
Name: d.Get("name").(string),
184+
Description: d.Get("description").(string),
179185
Type: d.Get("type").(string),
180186
URL: d.Get("url").(string),
181187
AutoPull: d.Get("auto_pull").(bool),
@@ -251,6 +257,9 @@ func resourceRegistryRead(d *schema.ResourceData, m interface{}) error {
251257
if err = d.Set("name", r.Name); err != nil {
252258
return err
253259
}
260+
if err = d.Set("description", r.Description); err != nil {
261+
return err
262+
}
254263
if err = d.Set("author", r.Author); err != nil {
255264
return err
256265
}

aquasec/resource_registry_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ func TestAquasecresourceRegistry(t *testing.T) {
1818
password := ""
1919
autopull := false
2020
scanner_type := "any"
21+
description := "Terrafrom-test"
2122
resource.Test(t, resource.TestCase{
2223
PreCheck: func() { testAccPreCheck(t) },
2324
Providers: testAccProviders,
2425
CheckDestroy: CheckDestroy("aquasec_integration_registry.new"),
2526
Steps: []resource.TestStep{
2627
{
27-
Config: testAccCheckAquasecRegistry(name, url, rtype, username, password, autopull, scanner_type),
28+
Config: testAccCheckAquasecRegistry(name, url, rtype, username, password, autopull, scanner_type, description),
2829
Check: resource.ComposeTestCheckFunc(
2930
testAccCheckAquasecRegistryExists("aquasec_integration_registry.new"),
3031
),
@@ -39,7 +40,7 @@ func TestAquasecresourceRegistry(t *testing.T) {
3940
})
4041
}
4142

42-
func testAccCheckAquasecRegistry(name string, url string, rtype string, username string, password string, autopull bool, scanner_type string) string {
43+
func testAccCheckAquasecRegistry(name string, url string, rtype string, username string, password string, autopull bool, scanner_type string, description string) string {
4344
return fmt.Sprintf(`
4445
resource "aquasec_integration_registry" "new" {
4546
name = "%s"
@@ -49,7 +50,8 @@ func testAccCheckAquasecRegistry(name string, url string, rtype string, username
4950
password = "%s"
5051
auto_pull = "%v"
5152
scanner_type = "%s"
52-
}`, name, url, rtype, username, password, autopull, scanner_type)
53+
description = "%s"
54+
}`, name, url, rtype, username, password, autopull, scanner_type, description)
5355

5456
}
5557

0 commit comments

Comments
 (0)