Skip to content

Commit

Permalink
Merge pull request #36647 from fatbasstard/f/myapplication-tag
Browse files Browse the repository at this point in the history
Fix/Enhancement: Add application_tag attribute to aws_servicecatalogappregistry_application
  • Loading branch information
jar-b authored Apr 2, 2024
2 parents cb7ea81 + 2f2e0d6 commit 253cd51
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .changelog/36647.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_servicecatalogappregistry_application: Add `application_tag` attribute
```

```release-note:enhancement
data-source//aws_servicecatalogappregistry_application: Add `application_tag` attribute
```
13 changes: 9 additions & 4 deletions internal/service/servicecatalogappregistry/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (r *resourceApplication) Schema(ctx context.Context, req resource.SchemaReq
stringplanmodifier.RequiresReplace(),
},
},
"application_tag": schema.MapAttribute{
ElementType: types.StringType,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -219,8 +223,9 @@ func findApplicationByID(ctx context.Context, conn *servicecatalogappregistry.Cl
}

type resourceApplicationData struct {
ARN types.String `tfsdk:"arn"`
Description types.String `tfsdk:"description"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ARN types.String `tfsdk:"arn"`
Description types.String `tfsdk:"description"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ApplicationTag types.Map `tfsdk:"application_tag"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func (d *dataSourceApplication) Schema(ctx context.Context, req datasource.Schem
"name": schema.StringAttribute{
Computed: true,
},
"application_tag": schema.MapAttribute{
ElementType: types.StringType,
Computed: true,
},
},
}
}
Expand All @@ -71,8 +75,9 @@ func (d *dataSourceApplication) Read(ctx context.Context, req datasource.ReadReq
}

type dataSourceApplicationData struct {
ARN types.String `tfsdk:"arn"`
Description types.String `tfsdk:"description"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ARN types.String `tfsdk:"arn"`
Description types.String `tfsdk:"description"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ApplicationTag types.Map `tfsdk:"application_tag"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@ resource "aws_servicecatalogappregistry_application" "test" {
data "aws_servicecatalogappregistry_application" "test" {
id = aws_servicecatalogappregistry_application.test.id
}
resource "aws_ssm_parameter" "test" {
name = %[1]q
type = "String"
value = "test"
tags = data.aws_servicecatalogappregistry_application.test.application_tag
}
`, rName)
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ func testAccApplicationConfig_basic(name string) string {
resource "aws_servicecatalogappregistry_application" "test" {
name = %[1]q
}
resource "aws_ssm_parameter" "test" {
name = %[1]q
type = "String"
value = "test"
tags = aws_servicecatalogappregistry_application.test.application_tag
}
`, name)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The following arguments are required:

This data source exports the following attributes in addition to the arguments above:

* `application_tag` - A map with a single tag key-value pair used to associate resources with the application.
* `arn` - ARN (Amazon Resource Name) of the application.
* `description` - Description of the application.
* `name` - Name of the application.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ resource "aws_servicecatalogappregistry_application" "example" {
resource "aws_s3_bucket" "bucket" {
bucket = "example-bucket"
tags = {
awsApplication = aws_servicecatalogappregistry_application.example.arn
}
tags = aws_servicecatalogappregistry_application.example.application_tag
}
```

Expand All @@ -51,6 +49,7 @@ The following arguments are optional:

This resource exports the following attributes in addition to the arguments above:

* `application_tag` - A map with a single tag key-value pair used to associate resources with the application. This attribute can be passed directly into the `tags` argument of another resource, or merged into a map of existing tags.
* `arn` - ARN (Amazon Resource Name) of the application.
* `id` - Identifier of the application.

Expand Down

0 comments on commit 253cd51

Please sign in to comment.