From bea47b6c852a87410492e886d1f21677f02adcda Mon Sep 17 00:00:00 2001 From: shuheiktgw Date: Tue, 19 Jan 2021 07:55:48 +0900 Subject: [PATCH] Add arn and owner_id to License Manager license configuration --- ...esource_aws_licensemanager_license_configuration.go | 10 ++++++++++ ...ce_aws_licensemanager_license_configuration_test.go | 3 +++ .../r/licensemanager_license_configuration.markdown | 2 ++ 3 files changed, 15 insertions(+) diff --git a/aws/resource_aws_licensemanager_license_configuration.go b/aws/resource_aws_licensemanager_license_configuration.go index 8c8ca3216c9a..3a38bbf8a346 100644 --- a/aws/resource_aws_licensemanager_license_configuration.go +++ b/aws/resource_aws_licensemanager_license_configuration.go @@ -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, @@ -60,6 +64,10 @@ func resourceAwsLicenseManagerLicenseConfiguration() *schema.Resource { Type: schema.TypeString, Required: true, }, + "owner_account_id": { + Type: schema.TypeString, + Computed: true, + }, "tags": tagsSchema(), }, } @@ -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) @@ -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) diff --git a/aws/resource_aws_licensemanager_license_configuration_test.go b/aws/resource_aws_licensemanager_license_configuration_test.go index 56dfe03fdad4..0948bdee40d8 100644 --- a/aws/resource_aws_licensemanager_license_configuration_test.go +++ b/aws/resource_aws_licensemanager_license_configuration_test.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -72,6 +73,7 @@ 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"), @@ -79,6 +81,7 @@ func TestAccAWSLicenseManagerLicenseConfiguration_basic(t *testing.T) { 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"), ), diff --git a/website/docs/r/licensemanager_license_configuration.markdown b/website/docs/r/licensemanager_license_configuration.markdown index 09a6ab8edd53..e7b3162bffe7 100644 --- a/website/docs/r/licensemanager_license_configuration.markdown +++ b/website/docs/r/licensemanager_license_configuration.markdown @@ -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