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

resource/aws_licensemanager_license_configuration: Add arn and owner_account_id attributes #17160

Merged
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
10 changes: 10 additions & 0 deletions aws/resource_aws_licensemanager_license_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func resourceAwsLicenseManagerLicenseConfiguration() *schema.Resource {
},

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -60,6 +64,10 @@ func resourceAwsLicenseManagerLicenseConfiguration() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"owner_account_id": {
Type: schema.TypeString,
Computed: true,
},
"tags": tagsSchema(),
},
}
Expand Down Expand Up @@ -120,6 +128,7 @@ func resourceAwsLicenseManagerLicenseConfigurationRead(d *schema.ResourceData, m
return fmt.Errorf("Error reading License Manager license configuration: %s", err)
}

d.Set("arn", resp.LicenseConfigurationArn)
d.Set("description", resp.Description)
d.Set("license_count", resp.LicenseCount)
d.Set("license_count_hard_limit", resp.LicenseCountHardLimit)
Expand All @@ -128,6 +137,7 @@ func resourceAwsLicenseManagerLicenseConfigurationRead(d *schema.ResourceData, m
return fmt.Errorf("error setting license_rules: %s", err)
}
d.Set("name", resp.Name)
d.Set("owner_account_id", resp.OwnerAccountId)

if err := d.Set("tags", keyvaluetags.LicensemanagerKeyValueTags(resp.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil {
return fmt.Errorf("error setting tags: %s", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package aws
import (
"fmt"
"log"
"regexp"
"testing"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -72,13 +73,15 @@ func TestAccAWSLicenseManagerLicenseConfiguration_basic(t *testing.T) {
Config: testAccLicenseManagerLicenseConfigurationConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLicenseManagerLicenseConfigurationExists(resourceName, &licenseConfiguration),
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "license-manager", regexp.MustCompile(`license-configuration:lic-.+`)),
resource.TestCheckResourceAttr(resourceName, "name", "Example"),
resource.TestCheckResourceAttr(resourceName, "description", "Example"),
resource.TestCheckResourceAttr(resourceName, "license_count", "10"),
resource.TestCheckResourceAttr(resourceName, "license_count_hard_limit", "true"),
resource.TestCheckResourceAttr(resourceName, "license_counting_type", "Socket"),
resource.TestCheckResourceAttr(resourceName, "license_rules.#", "1"),
resource.TestCheckResourceAttr(resourceName, "license_rules.0", "#minimumSockets=3"),
testAccCheckResourceAttrAccountID(resourceName, "owner_account_id"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "1"),
resource.TestCheckResourceAttr(resourceName, "tags.foo", "barr"),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ License rules should be in the format of `#RuleType=RuleValue`. Supported rule t

In addition to all arguments above, the following attributes are exported:

* `arn` - The license configuration ARN.
* `id` - The license configuration ARN.
* `owner_account_id` - Account ID of the owner of the license configuration.

## Import

Expand Down