Skip to content

Commit

Permalink
Merge branch 'add_arn_and_owner_id_to_license_configuration' of ssh:/…
Browse files Browse the repository at this point in the history
…/github.com/shuheiktgw/terraform-provider-aws into shuheiktgw-add_arn_and_owner_id_to_license_configuration
  • Loading branch information
bflad committed Feb 11, 2021
2 parents df2b927 + bea47b6 commit c9fd565
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
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
3 changes: 3 additions & 0 deletions aws/resource_aws_licensemanager_license_configuration_test.go
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
2 changes: 2 additions & 0 deletions website/docs/r/licensemanager_license_configuration.markdown
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

0 comments on commit c9fd565

Please sign in to comment.