diff --git a/.changelog/24278.txt b/.changelog/24278.txt new file mode 100644 index 00000000000..733a7f0ad58 --- /dev/null +++ b/.changelog/24278.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_elastic_beanstalk_environment: Correctly set `cname_prefix` attribute +``` \ No newline at end of file diff --git a/internal/service/elasticbeanstalk/environment.go b/internal/service/elasticbeanstalk/environment.go index b0ed357acfb..ba801479dde 100644 --- a/internal/service/elasticbeanstalk/environment.go +++ b/internal/service/elasticbeanstalk/environment.go @@ -571,7 +571,7 @@ func resourceEnvironmentRead(d *schema.ResourceData, meta interface{}) error { } if env.CNAME != nil { - beanstalkCnamePrefixRegexp := regexp.MustCompile(`(^[^.]+)(.\w{2}-\w{4,9}-\d)?.(elasticbeanstalk.com|eb.amazonaws.com.cn)$`) + beanstalkCnamePrefixRegexp := regexp.MustCompile(`(^[^.]+)(.\w{2}-\w{4,9}-\d)?\.(elasticbeanstalk\.com|eb\.amazonaws\.com\.cn)$`) var cnamePrefix string cnamePrefixMatch := beanstalkCnamePrefixRegexp.FindStringSubmatch(*env.CNAME)