Skip to content

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Sep 10, 2025

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

Since these actions may be merged in bulk, extra checklist to help:

  • Rebase on Actions plumbing #43669 after it's updated, deconflicted
  • Changelog
  • PR description
  • Action file
  • Test file with terraform_data trigger
  • Test results in PR
  • website/docs/actions/ file
  • Warning at top of website docs
  • Update warning on top of website docs
  • Service package registration
  • Update code for simplified actions
  • Use region pattern (framework.WithRegionModel)
  • Add 1.14 skips for tests
  • Rerun all tests after final rebase

Add aws_sns_publish Action

This PR adds a new Terraform action for publishing messages to Amazon SNS topics. The action enables imperative message publishing with support for message attributes, subjects, and different message structures.

Example Usage

action "aws_sns_publish" "notification" {
  config {
    topic_arn = aws_sns_topic.alerts.arn
    message   = "Deployment completed successfully"
    subject   = "Deployment Status"
    
    message_attributes {
      map_block_key = "priority"
      data_type     = "String"
      string_value  = "high"
    }
  }
}

resource "terraform_data" "deploy_trigger" {
  lifecycle {
    action_trigger {
      events  = [after_create]
      actions = [action.aws_sns_publish.notification]
    }
  }
}

Features

  • Publishes messages to SNS topics during Terraform operations
  • Supports message attributes for metadata
  • Optional subject for email protocols
  • JSON message structure support
  • Built using the Plugin Framework with AutoFlex for type conversion

Relations

References

Output from Acceptance Testing

% make t T=TestAccSNSPublishAction K=sns             
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.6 test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSPublishAction'  -timeout 360m -vet=off
2025/09/10 17:06:16 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/10 17:06:16 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccSNSPublishAction_basic
=== PAUSE TestAccSNSPublishAction_basic
=== RUN   TestAccSNSPublishAction_withAttributes
=== PAUSE TestAccSNSPublishAction_withAttributes
=== CONT  TestAccSNSPublishAction_basic
=== CONT  TestAccSNSPublishAction_withAttributes
--- PASS: TestAccSNSPublishAction_basic (97.70s)
--- PASS: TestAccSNSPublishAction_withAttributes (97.79s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	103.052s

Copy link
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/sns Issues and PRs that pertain to the sns service. provider Pertains to the provider itself, rather than any interaction with AWS. client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. size/XL Managed by automation to categorize the size of a PR. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Sep 10, 2025
@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Sep 10, 2025
@YakDriver YakDriver changed the title New action: aws_sns_publish New action: aws_sns_publish Sep 10, 2025
This was referenced Sep 10, 2025
@github-actions github-actions bot added linter Pertains to changes to or issues with the various linters. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels Sep 17, 2025
@YakDriver
Copy link
Member Author

Latest:

% make t T=TestAccSNSPublishAction K=sns
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-aws_sns_publish_message 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSPublishAction'  -timeout 360m -vet=off
2025/09/16 22:42:07 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/16 22:42:07 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccSNSPublishAction_basic
=== PAUSE TestAccSNSPublishAction_basic
=== RUN   TestAccSNSPublishAction_withAttributes
=== PAUSE TestAccSNSPublishAction_withAttributes
=== CONT  TestAccSNSPublishAction_basic
=== CONT  TestAccSNSPublishAction_withAttributes
--- PASS: TestAccSNSPublishAction_withAttributes (98.50s)
--- PASS: TestAccSNSPublishAction_basic (98.51s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	103.802s

@YakDriver
Copy link
Member Author

After rebasing:

% make t T=TestAccSNSPublishAction_ K=sns       
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-aws_sns_publish_message 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSPublishAction_'  -timeout 360m -vet=off
2025/09/17 12:02:14 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/17 12:02:14 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccSNSPublishAction_basic
=== PAUSE TestAccSNSPublishAction_basic
=== RUN   TestAccSNSPublishAction_withAttributes
=== PAUSE TestAccSNSPublishAction_withAttributes
=== CONT  TestAccSNSPublishAction_basic
=== CONT  TestAccSNSPublishAction_withAttributes
--- PASS: TestAccSNSPublishAction_basic (97.50s)
--- PASS: TestAccSNSPublishAction_withAttributes (97.59s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	103.131s

@YakDriver YakDriver marked this pull request as ready for review September 17, 2025 16:05
@YakDriver YakDriver requested a review from a team as a code owner September 17, 2025 16:05
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% TF_ACC_TERRAFORM_PATH=/Users/jaredbaker/go/bin/terraform make t K=sns T=TestAccSNSPublishAction_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 f-aws_sns_publish_message 🌿...
TF_ACC=1 go1.24.6 test ./internal/service/sns/... -v -count 1 -parallel 20 -run='TestAccSNSPublishAction_'  -timeout 360m -vet=off
2025/09/17 15:39:51 Creating Terraform AWS Provider (SDKv2-style)...
2025/09/17 15:39:51 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccSNSPublishAction_withAttributes (97.28s)
--- PASS: TestAccSNSPublishAction_basic (97.28s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sns        103.937s

@YakDriver YakDriver merged commit 2e87167 into main Sep 17, 2025
72 checks passed
@YakDriver YakDriver deleted the f-aws_sns_publish_message branch September 17, 2025 19:44
Copy link
Contributor

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v6.14.0 milestone Sep 17, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 18, 2025
Copy link
Contributor

This functionality has been released in v6.14.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-connections Pertains to the AWS Client and service connections. documentation Introduces or discusses updates to documentation. generators Relates to code generators. linter Pertains to changes to or issues with the various linters. provider Pertains to the provider itself, rather than any interaction with AWS. repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. service/sns Issues and PRs that pertain to the sns service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants