Skip to content

Commit

Permalink
Merge pull request #35290 from acwwat/b-aws_grafana_license_associati…
Browse files Browse the repository at this point in the history
…on-set_workspace_id_on_import

fix: Add missing workspace_id from importing aws_grafana_license_association
  • Loading branch information
ewbankkit committed Jan 24, 2024
2 parents d887a4c + 1f0ac52 commit 3d67697
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/35290.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_grafana_license_association: Fix missing `workspace_id` attribute after import
```
12 changes: 12 additions & 0 deletions internal/service/grafana/grafana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ package grafana_test
import (
"testing"

"github.com/aws/aws-sdk-go/service/managedgrafana"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
)

func init() {
acctest.RegisterServiceErrorCheckFunc(managedgrafana.EndpointsID, testAccErrorCheckSkip)
}

func testAccErrorCheckSkip(t *testing.T) resource.ErrorCheckFunc {
return acctest.ErrorCheckSkipMessagesContaining(t,
"Active marketplace agreement not found",
)
}

func TestAccGrafana_serial(t *testing.T) {
t.Parallel()

Expand Down
1 change: 1 addition & 0 deletions internal/service/grafana/license_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func resourceLicenseAssociationRead(ctx context.Context, d *schema.ResourceData,
d.Set("license_expiration", nil)
}
d.Set("license_type", workspace.LicenseType)
d.Set("workspace_id", d.Id())

return diags
}
Expand Down
5 changes: 5 additions & 0 deletions internal/service/grafana/license_association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func testAccLicenseAssociation_freeTrial(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "workspace_id", workspaceResourceName, "id"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down

0 comments on commit 3d67697

Please sign in to comment.